docs(api/v2): tag LinkSharing fields for the v2 schema
Add doc:/readOnly:/writeOnly: tags to the shared LinkSharing model so the Huma-generated /api/v2 schema documents every exposed field. password is write-only (set on create, never returned); hash, sharing_type, id, created, updated and shared_by are server-controlled and marked read-only. swaggo/XORM/govalidator ignore these tags, so v1 is unaffected.
This commit is contained in:
parent
cae89caef2
commit
4e5751ebfe
|
|
@ -45,30 +45,30 @@ const (
|
|||
// LinkSharing represents a shared project
|
||||
type LinkSharing struct {
|
||||
// The ID of the shared thing
|
||||
ID int64 `xorm:"bigint autoincr not null unique pk" json:"id" param:"share"`
|
||||
ID int64 `xorm:"bigint autoincr not null unique pk" json:"id" param:"share" readOnly:"true" doc:"The unique, numeric id of this link share."`
|
||||
// The public id to get this shared project
|
||||
Hash string `xorm:"varchar(40) not null unique" json:"hash" param:"hash"`
|
||||
Hash string `xorm:"varchar(40) not null unique" json:"hash" param:"hash" readOnly:"true" doc:"The public hash used to access the shared project. Generated by the server; ignored on write."`
|
||||
// The name of this link share. All actions someone takes while being authenticated with that link will appear with that name.
|
||||
Name string `xorm:"text null" json:"name"`
|
||||
Name string `xorm:"text null" json:"name" doc:"The name of this link share. All actions someone takes while authenticated through this link will appear under this name."`
|
||||
// The ID of the shared project
|
||||
ProjectID int64 `xorm:"bigint not null" json:"-" param:"project"`
|
||||
// The permission this project is shared with. 0 = Read only, 1 = Read & Write, 2 = Admin. See the docs for more details.
|
||||
Permission Permission `xorm:"bigint INDEX not null default 0" json:"permission" valid:"length(0|2)" maximum:"2" default:"0"`
|
||||
Permission Permission `xorm:"bigint INDEX not null default 0" json:"permission" valid:"length(0|2)" maximum:"2" default:"0" doc:"The permission this project is shared with: 0 = read only, 1 = read & write, 2 = admin."`
|
||||
|
||||
// The kind of this link. 0 = undefined, 1 = without password, 2 = with password.
|
||||
SharingType SharingType `xorm:"bigint INDEX not null default 0" json:"sharing_type" valid:"length(0|2)" maximum:"2" default:"0"`
|
||||
SharingType SharingType `xorm:"bigint INDEX not null default 0" json:"sharing_type" valid:"length(0|2)" maximum:"2" default:"0" readOnly:"true" doc:"The kind of this link, derived from whether a password was set: 0 = undefined, 1 = without password, 2 = with password."`
|
||||
|
||||
// The password of this link share. You can only set it, not retrieve it after the link share has been created.
|
||||
Password string `xorm:"text null" json:"password"`
|
||||
Password string `xorm:"text null" json:"password" writeOnly:"true" doc:"The password protecting this link share. Write-only: it can be set on create but is never returned."`
|
||||
|
||||
// The user who shared this project
|
||||
SharedBy *user.User `xorm:"-" json:"shared_by"`
|
||||
SharedBy *user.User `xorm:"-" json:"shared_by" readOnly:"true" doc:"The user who created this link share."`
|
||||
SharedByID int64 `xorm:"bigint INDEX not null" json:"-"`
|
||||
|
||||
// A timestamp when this project was shared. 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" doc:"A timestamp when this share was created. You cannot change this value."`
|
||||
// A timestamp when this share 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" doc:"A timestamp when this share was last updated. You cannot change this value."`
|
||||
|
||||
web.CRUDable `xorm:"-" json:"-"`
|
||||
web.Permissions `xorm:"-" json:"-"`
|
||||
|
|
|
|||
Loading…
Reference in New Issue