fix: rename custom fields handlers, clean metadata API, remove Version field #645
@@ -1480,11 +1480,11 @@ func Routes() *web.Router {
|
||||
}, reqAdmin())
|
||||
}, reqAnyRepoReader())
|
||||
m.Combo("/metadata", reqRepoReader(unit.TypeCode)).
|
||||
Get(repo.GetRepoManifestMetadata).
|
||||
Put(reqToken(), reqAdmin(), repo.UpdateRepoManifestMetadata)
|
||||
Get(repo.GetRepoMetadata).
|
||||
Put(reqToken(), reqAdmin(), repo.UpdateRepoMetadata)
|
||||
m.Combo("/manifest", reqRepoReader(unit.TypeCode)). // backward compat
|
||||
Get(repo.GetRepoManifestMetadata).
|
||||
Put(reqToken(), reqAdmin(), repo.UpdateRepoManifestMetadata)
|
||||
Get(repo.GetRepoMetadata).
|
||||
Put(reqToken(), reqAdmin(), repo.UpdateRepoMetadata)
|
||||
// MokoGitea badge engine
|
||||
m.Get("/badge/{type}.svg", repo.GetRepoBadge)
|
||||
m.Get("/issue_templates", reqRepoReader(unit.TypeCode), context.ReferencesGitRepo(), repo.GetIssueTemplates)
|
||||
@@ -1661,10 +1661,10 @@ func Routes() *web.Router {
|
||||
// })
|
||||
// })
|
||||
// })
|
||||
// Repo metadata (repo-scoped custom fields)
|
||||
m.Group("/metadata", func() {
|
||||
m.Get("", repo.GetRepoManifestMetadata)
|
||||
m.Put("", reqToken(), reqRepoWriter(unit.TypeCode), repo.SetRepoMetadata)
|
||||
// Repo custom fields (repo-scoped key-value metadata)
|
||||
m.Group("/custom-fields", func() {
|
||||
m.Get("", repo.GetRepoCustomFields)
|
||||
m.Put("", reqToken(), reqRepoWriter(unit.TypeCode), repo.SetRepoCustomFields)
|
||||
})
|
||||
// Issue custom fields
|
||||
m.Group("/issues/{index}/custom-fields", func() {
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
"code.mokoconsulting.tech/MokoConsulting/MokoGitea/services/context"
|
||||
)
|
||||
|
||||
// GetRepoMetadata returns all repo-scoped custom field values.
|
||||
func GetRepoMetadata(ctx *context.APIContext) {
|
||||
// GetRepoCustomFields returns all repo-scoped custom field values.
|
||||
func GetRepoCustomFields(ctx *context.APIContext) {
|
||||
ownerID := ctx.Repo.Repository.OwnerID
|
||||
repoID := ctx.Repo.Repository.ID
|
||||
|
||||
@@ -35,8 +35,8 @@ func GetRepoMetadata(ctx *context.APIContext) {
|
||||
ctx.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// SetRepoMetadata sets repo-scoped custom field values.
|
||||
func SetRepoMetadata(ctx *context.APIContext) {
|
||||
// SetRepoCustomFields sets repo-scoped custom field values.
|
||||
func SetRepoCustomFields(ctx *context.APIContext) {
|
||||
ownerID := ctx.Repo.Repository.OwnerID
|
||||
repoID := ctx.Repo.Repository.ID
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ type apiMetadata struct {
|
||||
}
|
||||
|
||||
// GetRepoMetadata returns the manifest settings for a repository.
|
||||
func GetRepoManifestMetadata(ctx *context.APIContext) {
|
||||
func GetRepoMetadata(ctx *context.APIContext) {
|
||||
// swagger:operation GET /repos/{owner}/{repo}/manifest repository repoGetManifest
|
||||
// ---
|
||||
// summary: Get repo manifest settings
|
||||
@@ -85,7 +85,7 @@ func GetRepoManifestMetadata(ctx *context.APIContext) {
|
||||
}
|
||||
|
||||
// UpdateRepoMetadata updates the manifest settings for a repository.
|
||||
func UpdateRepoManifestMetadata(ctx *context.APIContext) {
|
||||
func UpdateRepoMetadata(ctx *context.APIContext) {
|
||||
// swagger:operation PUT /repos/{owner}/{repo}/manifest repository repoUpdateManifest
|
||||
// ---
|
||||
// summary: Update repo manifest settings
|
||||
|
||||
Reference in New Issue
Block a user