fix(build): merge custom fields build fix to main #451
@@ -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))
|
||||
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
VERSION: 05.20.00
|
||||
VERSION: 05.21.00
|
||||
-->
|
||||
|
||||
<updates>
|
||||
@@ -87,13 +87,13 @@
|
||||
<element>mokogitea</element>
|
||||
<type>application</type>
|
||||
<client>site</client>
|
||||
<version>05.20.00</version>
|
||||
<version>05.21.00</version>
|
||||
<creationDate>2026-06-04</creationDate>
|
||||
<infourl title='MokoGitea'>https://git.mokoconsulting.tech/MokoConsulting/MokoGitea/releases/tag/stable</infourl>
|
||||
<downloads>
|
||||
<downloadurl type='full' format='zip'>https://git.mokoconsulting.tech/MokoConsulting/MokoGitea/releases/download/stable/mokogitea-05.20.00.zip</downloadurl>
|
||||
<downloadurl type='full' format='zip'>https://git.mokoconsulting.tech/MokoConsulting/MokoGitea/releases/download/stable/mokogitea-05.21.00.zip</downloadurl>
|
||||
</downloads>
|
||||
<sha256>611a70dc0c394266e598598adc254fa50130310ffe21b966f820536e1714eb07</sha256>
|
||||
<sha256>6c5772549d9f20dd888a0f6eae24d2645a1c5042578c370a9bba93650db62abd</sha256>
|
||||
<tags><tag>stable</tag></tags>
|
||||
<changelogurl>https://git.mokoconsulting.tech/MokoConsulting/MokoGitea/raw/branch/main/CHANGELOG.md</changelogurl>
|
||||
<maintainer>Moko Consulting</maintainer>
|
||||
|
||||
Reference in New Issue
Block a user