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": {
"type": "string"
},
"CreatedAt": {
"type": "string"
},
"Keywords": {
"type": "string"
},
@@ -1273,6 +1276,9 @@
"NotesSrc": {
"type": "string"
},
"PhotoID": {
"type": "integer"
},
"Software": {
"type": "string"
},
@@ -1285,13 +1291,7 @@
"SubjectSrc": {
"type": "string"
},
"createdAt": {
"type": "string"
},
"photoID": {
"type": "integer"
},
"updatedAt": {
"UpdatedAt": {
"type": "string"
}
},

View File

@@ -12,7 +12,7 @@ var photoDetailsMutex = sync.Mutex{}
// Details stores denormalized photo metadata to speed up search and filtering.
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"`
KeywordsSrc string `gorm:"type:VARBINARY(8);" json:"KeywordsSrc" yaml:"KeywordsSrc,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"`
Software string `gorm:"type:VARCHAR(1024);" json:"Software" yaml:"Software,omitempty"`
SoftwareSrc string `gorm:"type:VARBINARY(8);" json:"SoftwareSrc" yaml:"SoftwareSrc,omitempty"`
CreatedAt time.Time `yaml:"-"`
UpdatedAt time.Time `yaml:"-"`
CreatedAt time.Time `json:"CreatedAt" yaml:"-"`
UpdatedAt time.Time `json:"UpdatedAt" yaml:"-"`
}
// 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.
type FileShare struct {
FileID uint `gorm:"primary_key;auto_increment:false"`
ServiceID uint `gorm:"primary_key;auto_increment:false"`
RemoteName string `gorm:"primary_key;auto_increment:false;type:VARBINARY(255)"`
Status string `gorm:"type:VARBINARY(16);"`
Error string `gorm:"type:VARBINARY(512);"`
Errors int
File *File
Account *Service
CreatedAt time.Time
UpdatedAt time.Time
FileID uint `gorm:"primary_key;auto_increment:false" json:"FileID" yaml:"FileID,omitempty"`
ServiceID uint `gorm:"primary_key;auto_increment:false" json:"ServiceID" yaml:"ServiceID,omitempty"`
RemoteName string `gorm:"primary_key;auto_increment:false;type:VARBINARY(255)" json:"RemoteName" yaml:"RemoteName,omitempty"`
Status string `gorm:"type:VARBINARY(16);" json:"Status" yaml:"Status,omitempty"`
Error string `gorm:"type:VARBINARY(512);" json:"Error,omitempty" yaml:"Error,omitempty"`
Errors int `json:"Errors,omitempty" yaml:"Errors,omitempty"`
File *File `json:"File,omitempty" yaml:"-"`
Account *Service `json:"Account,omitempty" yaml:"-"`
CreatedAt time.Time `json:"CreatedAt" yaml:"CreatedAt"`
UpdatedAt time.Time `json:"UpdatedAt" yaml:"UpdatedAt"`
}
// 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.
type FileSync struct {
RemoteName string `gorm:"primary_key;auto_increment:false;type:VARBINARY(255)"`
ServiceID uint `gorm:"primary_key;auto_increment:false"`
FileID uint `gorm:"index;"`
RemoteDate time.Time
RemoteSize int64
Status string `gorm:"type:VARBINARY(16);"`
Error string `gorm:"type:VARBINARY(512);"`
Errors int
File *File
Account *Service
CreatedAt time.Time
UpdatedAt time.Time
RemoteName string `gorm:"primary_key;auto_increment:false;type:VARBINARY(255)" json:"RemoteName" yaml:"RemoteName,omitempty"`
ServiceID uint `gorm:"primary_key;auto_increment:false" json:"ServiceID" yaml:"ServiceID,omitempty"`
FileID uint `gorm:"index;" json:"FileID" yaml:"FileID,omitempty"`
RemoteDate time.Time `json:"RemoteDate,omitempty" yaml:"RemoteDate,omitempty"`
RemoteSize int64 `json:"RemoteSize,omitempty" yaml:"RemoteSize,omitempty"`
Status string `gorm:"type:VARBINARY(16);" json:"Status" yaml:"Status,omitempty"`
Error string `gorm:"type:VARBINARY(512);" json:"Error,omitempty" yaml:"Error,omitempty"`
Errors int `json:"Errors,omitempty" yaml:"Errors,omitempty"`
File *File `json:"File,omitempty" yaml:"-"`
Account *Service `json:"Account,omitempty" yaml:"-"`
CreatedAt time.Time `json:"CreatedAt" yaml:"CreatedAt"`
UpdatedAt time.Time `json:"UpdatedAt" yaml:"UpdatedAt"`
}
// TableName returns the entity table name.

View File

@@ -44,7 +44,7 @@ type Folder struct {
UpdatedAt time.Time `json:"-" yaml:"-"`
ModifiedAt time.Time `json:"ModifiedAt,omitempty" yaml:"-"`
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.

View File

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