docs(api/v2): mark server-controlled label and user fields read-only

This commit is contained in:
kolaente 2026-05-31 15:27:44 +02:00
parent 451bd5a8d6
commit 78ca1904b5
No known key found for this signature in database
GPG Key ID: F40E70337AB24C9B
2 changed files with 8 additions and 8 deletions

View File

@ -29,7 +29,7 @@ import (
// Label represents a label
type Label struct {
// The unique, numeric id of this label.
ID int64 `xorm:"bigint autoincr not null unique pk" json:"id" param:"label" doc:"The unique, numeric id of this label."`
ID int64 `xorm:"bigint autoincr not null unique pk" json:"id" param:"label" readOnly:"true" doc:"The unique, numeric id of this label."`
// The title of the label. You'll see this one on tasks associated with it.
Title string `xorm:"varchar(250) not null" json:"title" valid:"runelength(1|250)" minLength:"1" maxLength:"250" doc:"The title of the label. You'll see this one on tasks associated with it."`
// The label description.
@ -39,12 +39,12 @@ type Label struct {
CreatedByID int64 `xorm:"bigint not null" json:"-"`
// The user who created this label
CreatedBy *user.User `xorm:"-" json:"created_by" doc:"The user who created this label."`
CreatedBy *user.User `xorm:"-" json:"created_by" readOnly:"true" doc:"The user who created this label."`
// A timestamp when this label was created. You cannot change this value.
Created time.Time `xorm:"created not null" json:"created" doc:"A timestamp when this label was created. You cannot change this value."`
Created time.Time `xorm:"created not null" json:"created" readOnly:"true" doc:"A timestamp when this label was created. You cannot change this value."`
// A timestamp when this label was last updated. You cannot change this value.
Updated time.Time `xorm:"updated not null" json:"updated" doc:"A timestamp when this label was last updated. You cannot change this value."`
Updated time.Time `xorm:"updated not null" json:"updated" readOnly:"true" doc:"A timestamp when this label was last updated. You cannot change this value."`
web.CRUDable `xorm:"-" json:"-"`
web.Permissions `xorm:"-" json:"-"`

View File

@ -84,7 +84,7 @@ const (
// User holds information about an user
type User struct {
// The unique, numeric id of this user.
ID int64 `xorm:"bigint autoincr not null unique pk" json:"id" param:"bot"`
ID int64 `xorm:"bigint autoincr not null unique pk" json:"id" param:"bot" readOnly:"true"`
// The full name of the user.
Name string `xorm:"text null" json:"name"`
// The username of the user. Is always unique.
@ -112,7 +112,7 @@ type User struct {
DefaultProjectID int64 `xorm:"bigint null index" json:"-"`
// BotOwnerID is the ID of the owning (human) user if this user is a bot.
// A non-zero value means this user is a bot and cannot authenticate via password.
BotOwnerID int64 `xorm:"bigint null index" json:"bot_owner_id,omitempty"`
BotOwnerID int64 `xorm:"bigint null index" json:"bot_owner_id,omitempty" readOnly:"true"`
WeekStart int `xorm:"null" json:"-"`
Language string `xorm:"varchar(50) null" json:"-" valid:"language"`
Timezone string `xorm:"varchar(255) null" json:"-"`
@ -126,9 +126,9 @@ type User struct {
ExportFileID int64 `xorm:"bigint null" json:"-"`
// A timestamp when this task was created. You cannot change this value.
Created time.Time `xorm:"created not null" json:"created"`
Created time.Time `xorm:"created not null" json:"created" readOnly:"true"`
// A timestamp when this task was last updated. You cannot change this value.
Updated time.Time `xorm:"updated not null" json:"updated"`
Updated time.Time `xorm:"updated not null" json:"updated" readOnly:"true"`
web.Auth `xorm:"-" json:"-"`
}