fix(build): remove stale custom field API routes and dead code #450
@@ -1,33 +0,0 @@
|
||||
// Copyright 2026 Moko Consulting. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package v1_25
|
||||
|
||||
import "xorm.io/xorm"
|
||||
|
||||
func AddCustomFieldTables(x *xorm.Engine) error {
|
||||
type CustomFieldDefinition struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
RepoID int64 `xorm:"INDEX NOT NULL"`
|
||||
Name string `xorm:"NOT NULL"`
|
||||
FieldType string `xorm:"NOT NULL"` // text, number, date, dropdown, checkbox
|
||||
Description string
|
||||
Required bool `xorm:"NOT NULL DEFAULT false"`
|
||||
Position int `xorm:"NOT NULL DEFAULT 0"`
|
||||
Options string `xorm:"TEXT"` // JSON array for dropdown options
|
||||
DefaultVal string
|
||||
CreatedUnix int64 `xorm:"INDEX created"`
|
||||
UpdatedUnix int64 `xorm:"INDEX updated"`
|
||||
}
|
||||
|
||||
type CustomFieldValue struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
IssueID int64 `xorm:"INDEX NOT NULL"`
|
||||
FieldID int64 `xorm:"INDEX NOT NULL"`
|
||||
Value string `xorm:"TEXT"`
|
||||
CreatedUnix int64 `xorm:"INDEX created"`
|
||||
UpdatedUnix int64 `xorm:"INDEX updated"`
|
||||
}
|
||||
|
||||
return x.Sync(new(CustomFieldDefinition), new(CustomFieldValue))
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
// Copyright 2026 Moko Consulting. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package structs
|
||||
|
||||
import "time"
|
||||
|
||||
// CustomFieldDefinition represents a custom field definition for a repository
|
||||
// swagger:model
|
||||
type CustomFieldDefinition struct {
|
||||
ID int64 `json:"id"`
|
||||
RepoID int64 `json:"repo_id"`
|
||||
Name string `json:"name"`
|
||||
FieldType string `json:"field_type"`
|
||||
Description string `json:"description"`
|
||||
Required bool `json:"required"`
|
||||
Position int `json:"position"`
|
||||
Options string `json:"options"`
|
||||
DefaultValue string `json:"default_value"`
|
||||
// swagger:strfmt date-time
|
||||
Created time.Time `json:"created_at"`
|
||||
// swagger:strfmt date-time
|
||||
Updated time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
// CreateCustomFieldOption options for creating a custom field
|
||||
// swagger:model
|
||||
type CreateCustomFieldOption struct {
|
||||
// required: true
|
||||
Name string `json:"name" binding:"Required"`
|
||||
// required: true
|
||||
FieldType string `json:"field_type" binding:"Required"` // text, number, date, dropdown, checkbox
|
||||
Description string `json:"description"`
|
||||
Required bool `json:"required"`
|
||||
Position int `json:"position"`
|
||||
Options string `json:"options"` // JSON array for dropdown
|
||||
DefaultValue string `json:"default_value"`
|
||||
}
|
||||
|
||||
// EditCustomFieldOption options for editing a custom field
|
||||
// swagger:model
|
||||
type EditCustomFieldOption struct {
|
||||
Name *string `json:"name"`
|
||||
Description *string `json:"description"`
|
||||
Required *bool `json:"required"`
|
||||
Position *int `json:"position"`
|
||||
Options *string `json:"options"`
|
||||
DefaultValue *string `json:"default_value"`
|
||||
}
|
||||
|
||||
// CustomFieldValue represents a custom field value for an issue
|
||||
// swagger:model
|
||||
type CustomFieldValue struct {
|
||||
ID int64 `json:"id"`
|
||||
IssueID int64 `json:"issue_id"`
|
||||
FieldID int64 `json:"field_id"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
// SetCustomFieldValueOption options for setting a custom field value
|
||||
// swagger:model
|
||||
type SetCustomFieldValueOption struct {
|
||||
// required: true
|
||||
Value string `json:"value" binding:"Required"`
|
||||
}
|
||||
+3
-16
@@ -1655,22 +1655,9 @@ func Routes() *web.Router {
|
||||
// })
|
||||
// })
|
||||
// })
|
||||
m.Group("/custom-fields", func() {
|
||||
m.Combo("").Get(repo.ListCustomFields).
|
||||
Post(reqToken(), reqRepoWriter(unit.TypeIssues), bind(api.CreateCustomFieldOption{}), repo.CreateCustomField)
|
||||
m.Group("/{fieldId}", func() {
|
||||
m.Combo("").Get(repo.GetCustomField).
|
||||
Patch(reqToken(), reqRepoWriter(unit.TypeIssues), bind(api.EditCustomFieldOption{}), repo.EditCustomField).
|
||||
Delete(reqToken(), reqRepoWriter(unit.TypeIssues), repo.DeleteCustomField)
|
||||
})
|
||||
})
|
||||
m.Group("/issues/{index}/custom-fields", func() {
|
||||
m.Get("", repo.GetIssueCustomFields)
|
||||
m.Group("/{fieldId}", func() {
|
||||
m.Put("", reqToken(), reqRepoWriter(unit.TypeIssues), bind(api.SetCustomFieldValueOption{}), repo.SetIssueCustomField)
|
||||
m.Delete("", reqToken(), reqRepoWriter(unit.TypeIssues), repo.DeleteIssueCustomField)
|
||||
})
|
||||
})
|
||||
// TODO: custom-fields API routes — handler not yet implemented
|
||||
// m.Group("/custom-fields", func() { ... })
|
||||
// m.Group("/issues/{index}/custom-fields", func() { ... })
|
||||
}, repoAssignment(), checkTokenPublicOnly())
|
||||
}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryIssue))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user