diff --git a/internal/api/swagger.json b/internal/api/swagger.json index 0b83f019f..600bb3b53 100644 --- a/internal/api/swagger.json +++ b/internal/api/swagger.json @@ -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" } }, diff --git a/internal/entity/details.go b/internal/entity/details.go index ce81da893..50d896c3a 100644 --- a/internal/entity/details.go +++ b/internal/entity/details.go @@ -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. diff --git a/internal/entity/file_share.go b/internal/entity/file_share.go index 1b56e0053..15e0803c2 100644 --- a/internal/entity/file_share.go +++ b/internal/entity/file_share.go @@ -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. diff --git a/internal/entity/file_sync.go b/internal/entity/file_sync.go index e284d9f3d..e7fab2ced 100644 --- a/internal/entity/file_sync.go +++ b/internal/entity/file_sync.go @@ -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. diff --git a/internal/entity/folder.go b/internal/entity/folder.go index a815b97cb..2490b10d4 100644 --- a/internal/entity/folder.go +++ b/internal/entity/folder.go @@ -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. diff --git a/internal/entity/keyword.go b/internal/entity/keyword.go index 29f8234ff..5ec09ca6f 100644 --- a/internal/entity/keyword.go +++ b/internal/entity/keyword.go @@ -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.