Entity: Add missing json and yaml struct field tags; update swagger.json

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2025-10-14 21:18:34 +02:00
parent 3f6c7062bc
commit b1fc7ed55c
6 changed files with 36 additions and 36 deletions

View File

@@ -1255,6 +1255,9 @@
"CopyrightSrc": { "CopyrightSrc": {
"type": "string" "type": "string"
}, },
"CreatedAt": {
"type": "string"
},
"Keywords": { "Keywords": {
"type": "string" "type": "string"
}, },
@@ -1273,6 +1276,9 @@
"NotesSrc": { "NotesSrc": {
"type": "string" "type": "string"
}, },
"PhotoID": {
"type": "integer"
},
"Software": { "Software": {
"type": "string" "type": "string"
}, },
@@ -1285,13 +1291,7 @@
"SubjectSrc": { "SubjectSrc": {
"type": "string" "type": "string"
}, },
"createdAt": { "UpdatedAt": {
"type": "string"
},
"photoID": {
"type": "integer"
},
"updatedAt": {
"type": "string" "type": "string"
} }
}, },

View File

@@ -12,7 +12,7 @@ var photoDetailsMutex = sync.Mutex{}
// Details stores denormalized photo metadata to speed up search and filtering. // Details stores denormalized photo metadata to speed up search and filtering.
type Details struct { type Details struct {
PhotoID uint `gorm:"primary_key;auto_increment:false" yaml:"-"` PhotoID uint `gorm:"primary_key;auto_increment:false" json:"PhotoID" yaml:"-"`
Keywords string `gorm:"type:VARCHAR(2048);" json:"Keywords" yaml:"Keywords"` Keywords string `gorm:"type:VARCHAR(2048);" json:"Keywords" yaml:"Keywords"`
KeywordsSrc string `gorm:"type:VARBINARY(8);" json:"KeywordsSrc" yaml:"KeywordsSrc,omitempty"` KeywordsSrc string `gorm:"type:VARBINARY(8);" json:"KeywordsSrc" yaml:"KeywordsSrc,omitempty"`
Notes string `gorm:"type:VARCHAR(2048);" json:"Notes" yaml:"Notes,omitempty"` Notes string `gorm:"type:VARCHAR(2048);" json:"Notes" yaml:"Notes,omitempty"`
@@ -27,8 +27,8 @@ type Details struct {
LicenseSrc string `gorm:"type:VARBINARY(8);" json:"LicenseSrc" yaml:"LicenseSrc,omitempty"` LicenseSrc string `gorm:"type:VARBINARY(8);" json:"LicenseSrc" yaml:"LicenseSrc,omitempty"`
Software string `gorm:"type:VARCHAR(1024);" json:"Software" yaml:"Software,omitempty"` Software string `gorm:"type:VARCHAR(1024);" json:"Software" yaml:"Software,omitempty"`
SoftwareSrc string `gorm:"type:VARBINARY(8);" json:"SoftwareSrc" yaml:"SoftwareSrc,omitempty"` SoftwareSrc string `gorm:"type:VARBINARY(8);" json:"SoftwareSrc" yaml:"SoftwareSrc,omitempty"`
CreatedAt time.Time `yaml:"-"` CreatedAt time.Time `json:"CreatedAt" yaml:"-"`
UpdatedAt time.Time `yaml:"-"` UpdatedAt time.Time `json:"UpdatedAt" yaml:"-"`
} }
// TableName returns the entity table name. // TableName returns the entity table name.

View File

@@ -13,16 +13,16 @@ const (
// FileShare represents remote-sharing state for a file and a single connected service account. // FileShare represents remote-sharing state for a file and a single connected service account.
type FileShare struct { type FileShare struct {
FileID uint `gorm:"primary_key;auto_increment:false"` FileID uint `gorm:"primary_key;auto_increment:false" json:"FileID" yaml:"FileID,omitempty"`
ServiceID uint `gorm:"primary_key;auto_increment:false"` ServiceID uint `gorm:"primary_key;auto_increment:false" json:"ServiceID" yaml:"ServiceID,omitempty"`
RemoteName string `gorm:"primary_key;auto_increment:false;type:VARBINARY(255)"` RemoteName string `gorm:"primary_key;auto_increment:false;type:VARBINARY(255)" json:"RemoteName" yaml:"RemoteName,omitempty"`
Status string `gorm:"type:VARBINARY(16);"` Status string `gorm:"type:VARBINARY(16);" json:"Status" yaml:"Status,omitempty"`
Error string `gorm:"type:VARBINARY(512);"` Error string `gorm:"type:VARBINARY(512);" json:"Error,omitempty" yaml:"Error,omitempty"`
Errors int Errors int `json:"Errors,omitempty" yaml:"Errors,omitempty"`
File *File File *File `json:"File,omitempty" yaml:"-"`
Account *Service Account *Service `json:"Account,omitempty" yaml:"-"`
CreatedAt time.Time CreatedAt time.Time `json:"CreatedAt" yaml:"CreatedAt"`
UpdatedAt time.Time UpdatedAt time.Time `json:"UpdatedAt" yaml:"UpdatedAt"`
} }
// TableName returns the entity table name. // TableName returns the entity table name.

View File

@@ -15,18 +15,18 @@ const (
// FileSync tracks the synchronization status for a file on an external service. // FileSync tracks the synchronization status for a file on an external service.
type FileSync struct { type FileSync struct {
RemoteName string `gorm:"primary_key;auto_increment:false;type:VARBINARY(255)"` RemoteName string `gorm:"primary_key;auto_increment:false;type:VARBINARY(255)" json:"RemoteName" yaml:"RemoteName,omitempty"`
ServiceID uint `gorm:"primary_key;auto_increment:false"` ServiceID uint `gorm:"primary_key;auto_increment:false" json:"ServiceID" yaml:"ServiceID,omitempty"`
FileID uint `gorm:"index;"` FileID uint `gorm:"index;" json:"FileID" yaml:"FileID,omitempty"`
RemoteDate time.Time RemoteDate time.Time `json:"RemoteDate,omitempty" yaml:"RemoteDate,omitempty"`
RemoteSize int64 RemoteSize int64 `json:"RemoteSize,omitempty" yaml:"RemoteSize,omitempty"`
Status string `gorm:"type:VARBINARY(16);"` Status string `gorm:"type:VARBINARY(16);" json:"Status" yaml:"Status,omitempty"`
Error string `gorm:"type:VARBINARY(512);"` Error string `gorm:"type:VARBINARY(512);" json:"Error,omitempty" yaml:"Error,omitempty"`
Errors int Errors int `json:"Errors,omitempty" yaml:"Errors,omitempty"`
File *File File *File `json:"File,omitempty" yaml:"-"`
Account *Service Account *Service `json:"Account,omitempty" yaml:"-"`
CreatedAt time.Time CreatedAt time.Time `json:"CreatedAt" yaml:"CreatedAt"`
UpdatedAt time.Time UpdatedAt time.Time `json:"UpdatedAt" yaml:"UpdatedAt"`
} }
// TableName returns the entity table name. // TableName returns the entity table name.

View File

@@ -44,7 +44,7 @@ type Folder struct {
UpdatedAt time.Time `json:"-" yaml:"-"` UpdatedAt time.Time `json:"-" yaml:"-"`
ModifiedAt time.Time `json:"ModifiedAt,omitempty" yaml:"-"` ModifiedAt time.Time `json:"ModifiedAt,omitempty" yaml:"-"`
PublishedAt *time.Time `sql:"index" json:"PublishedAt,omitempty" yaml:"PublishedAt,omitempty"` PublishedAt *time.Time `sql:"index" json:"PublishedAt,omitempty" yaml:"PublishedAt,omitempty"`
DeletedAt *time.Time `sql:"index" json:"-"` DeletedAt *time.Time `sql:"index" json:"-" yaml:"DeletedAt,omitempty"`
} }
// TableName returns the entity table name. // TableName returns the entity table name.

View File

@@ -11,9 +11,9 @@ var keywordMutex = sync.Mutex{}
// Keyword represents a normalized word used for full-text search and tagging. // Keyword represents a normalized word used for full-text search and tagging.
type Keyword struct { type Keyword struct {
ID uint `gorm:"primary_key"` ID uint `gorm:"primary_key" json:"ID,omitempty" yaml:"ID,omitempty"`
Keyword string `gorm:"type:VARCHAR(64);index;"` Keyword string `gorm:"type:VARCHAR(64);index;" json:"Keyword" yaml:"Keyword,omitempty"`
Skip bool Skip bool `json:"Skip" yaml:"Skip"`
} }
// TableName returns the entity table name. // TableName returns the entity table name.