more db tag fixups

Signed-off-by: kim (grufwub) <grufwub@gmail.com>
This commit is contained in:
kim (grufwub) 2021-09-09 20:55:08 +01:00
commit b5e13a71fb
3 changed files with 8 additions and 8 deletions

View file

@ -31,11 +31,11 @@ type MediaAttachment struct {
StatusID string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // ID of the status to which this is attached StatusID string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // ID of the status to which this is attached
URL string `validate:"required_without=RemoteURL,omitempty,url" bun:",nullzero"` // Where can the attachment be retrieved on *this* server URL string `validate:"required_without=RemoteURL,omitempty,url" bun:",nullzero"` // Where can the attachment be retrieved on *this* server
RemoteURL string `validate:"required_without=URL,omitempty,url" bun:",nullzero"` // Where can the attachment be retrieved on a remote server (empty for local media) RemoteURL string `validate:"required_without=URL,omitempty,url" bun:",nullzero"` // Where can the attachment be retrieved on a remote server (empty for local media)
Type FileType `validate:"oneof=Image Gif Audio Video Unknown" bun:",notnull"` // Type of file (image/gif/audio/video) Type FileType `validate:"oneof=Image Gif Audio Video Unknown" bun:",nullzero,notnull"` // Type of file (image/gif/audio/video)
FileMeta FileMeta `validate:"required" bun:",nullzero,notnull"` // Metadata about the file FileMeta FileMeta `validate:"required" bun:",nullzero,notnull"` // Metadata about the file
AccountID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero,notnull"` // To which account does this attachment belong AccountID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero,notnull"` // To which account does this attachment belong
Account *Account `validate:"-" bun:"rel:has-one"` // Account corresponding to accountID Account *Account `validate:"-" bun:"rel:has-one"` // Account corresponding to accountID
Description string `validate:"-" bun:",nullzero"` // Description of the attachment (for screenreaders) Description string `validate:"-" bun:""` // Description of the attachment (for screenreaders)
ScheduledStatusID string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // To which scheduled status does this attachment belong ScheduledStatusID string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // To which scheduled status does this attachment belong
Blurhash string `validate:"required_if=Type Image,required_if=Type Gif,required_if=Type Video" bun:",nullzero"` // What is the generated blurhash of this attachment Blurhash string `validate:"required_if=Type Image,required_if=Type Gif,required_if=Type Video" bun:",nullzero"` // What is the generated blurhash of this attachment
Processing ProcessingStatus `validate:"oneof=0 1 2 666" bun:",notnull,default:2"` // What is the processing status of this attachment Processing ProcessingStatus `validate:"oneof=0 1 2 666" bun:",notnull,default:2"` // What is the processing status of this attachment
@ -49,7 +49,7 @@ type MediaAttachment struct {
type File struct { type File struct {
Path string `validate:"required,file" bun:",nullzero,notnull"` // Path of the file in storage. Path string `validate:"required,file" bun:",nullzero,notnull"` // Path of the file in storage.
ContentType string `validate:"required" bun:",nullzero,notnull"` // MIME content type of the file. ContentType string `validate:"required" bun:",nullzero,notnull"` // MIME content type of the file.
FileSize int `validate:"required" bun:",nullzero,notnull"` // File size in bytes FileSize int `validate:"required" bun:",notnull"` // File size in bytes
UpdatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // When was the file last updated. UpdatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // When was the file last updated.
} }
@ -57,7 +57,7 @@ type File struct {
type Thumbnail struct { type Thumbnail struct {
Path string `validate:"required,file" bun:",nullzero,notnull"` // Path of the file in storage. Path string `validate:"required,file" bun:",nullzero,notnull"` // Path of the file in storage.
ContentType string `validate:"required" bun:",nullzero,notnull"` // MIME content type of the file. ContentType string `validate:"required" bun:",nullzero,notnull"` // MIME content type of the file.
FileSize int `validate:"required" bun:",nullzero,notnull"` // File size in bytes FileSize int `validate:"required" bun:",notnull"` // File size in bytes
UpdatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // When was the file last updated. UpdatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // When was the file last updated.
URL string `validate:"required_without=RemoteURL,omitempty,url" bun:",nullzero"` // What is the URL of the thumbnail on the local server URL string `validate:"required_without=RemoteURL,omitempty,url" bun:",nullzero"` // What is the URL of the thumbnail on the local server
RemoteURL string `validate:"required_without=URL,omitempty,url" bun:",nullzero"` // What is the remote URL of the thumbnail (empty for local media) RemoteURL string `validate:"required_without=URL,omitempty,url" bun:",nullzero"` // What is the remote URL of the thumbnail (empty for local media)

View file

@ -29,7 +29,7 @@ type Status struct {
UpdatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item last updated UpdatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item last updated
URI string `validate:"required,url" bun:",unique,nullzero,notnull"` // activitypub URI of this status URI string `validate:"required,url" bun:",unique,nullzero,notnull"` // activitypub URI of this status
URL string `validate:"url" bun:",nullzero"` // web url for viewing this status URL string `validate:"url" bun:",nullzero"` // web url for viewing this status
Content string `validate:"-" bun:",nullzero"` // content of this status; likely html-formatted but not guaranteed Content string `validate:"-" bun:""` // content of this status; likely html-formatted but not guaranteed
AttachmentIDs []string `validate:"dive,ulid" bun:"attachments,array"` // Database IDs of any media attachments associated with this status AttachmentIDs []string `validate:"dive,ulid" bun:"attachments,array"` // Database IDs of any media attachments associated with this status
Attachments []*MediaAttachment `validate:"-" bun:"attached_media,rel:has-many"` // Attachments corresponding to attachmentIDs Attachments []*MediaAttachment `validate:"-" bun:"attached_media,rel:has-many"` // Attachments corresponding to attachmentIDs
TagIDs []string `validate:"dive,ulid" bun:"tags,array"` // Database IDs of any tags used in this status TagIDs []string `validate:"dive,ulid" bun:"tags,array"` // Database IDs of any tags used in this status
@ -52,13 +52,13 @@ type Status struct {
BoostOf *Status `validate:"-" bun:"-"` // status that corresponds to boostOfID BoostOf *Status `validate:"-" bun:"-"` // status that corresponds to boostOfID
BoostOfAccount *Account `validate:"-" bun:"rel:belongs-to"` // account that corresponds to boostOfAccountID BoostOfAccount *Account `validate:"-" bun:"rel:belongs-to"` // account that corresponds to boostOfAccountID
ContentWarning string `validate:"-" bun:",nullzero"` // cw string for this status ContentWarning string `validate:"-" bun:",nullzero"` // cw string for this status
Visibility Visibility `validate:"-" bun:",nullzero,notnull"` // visibility entry for this status Visibility Visibility `validate:"oneof=public unlocked followers_only mutuals_only direct" bun:",nullzero,notnull"` // visibility entry for this status
Sensitive bool `validate:"-" bun:",notnull,default:false"` // mark the status as sensitive? Sensitive bool `validate:"-" bun:",notnull,default:false"` // mark the status as sensitive?
Language string `validate:"-" bun:",nullzero"` // what language is this status written in? Language string `validate:"-" bun:",nullzero"` // what language is this status written in?
CreatedWithApplicationID string `validate:"required_if=Local true,omitempty,ulid" bun:"type:CHAR(26),nullzero"` // Which application was used to create this status? CreatedWithApplicationID string `validate:"required_if=Local true,omitempty,ulid" bun:"type:CHAR(26),nullzero"` // Which application was used to create this status?
CreatedWithApplication *Application `validate:"-" bun:"rel:belongs-to"` // application corresponding to createdWithApplicationID CreatedWithApplication *Application `validate:"-" bun:"rel:belongs-to"` // application corresponding to createdWithApplicationID
ActivityStreamsType string `validate:"required" bun:",nullzero,notnull"` // What is the activitystreams type of this status? See: https://www.w3.org/TR/activitystreams-vocabulary/#object-types. Will probably almost always be Note but who knows!. ActivityStreamsType string `validate:"required" bun:",nullzero,notnull"` // What is the activitystreams type of this status? See: https://www.w3.org/TR/activitystreams-vocabulary/#object-types. Will probably almost always be Note but who knows!.
Text string `validate:"-" bun:",nullzero"` // Original text of the status without formatting Text string `validate:"-" bun:""` // Original text of the status without formatting
Pinned bool `validate:"-" bun:",notnull,default:false"` // Has this status been pinned by its owner? Pinned bool `validate:"-" bun:",notnull,default:false"` // Has this status been pinned by its owner?
Federated bool `validate:"-" bun:",notnull"` // This status will be federated beyond the local timeline(s) Federated bool `validate:"-" bun:",notnull"` // This status will be federated beyond the local timeline(s)
Boostable bool `validate:"-" bun:",notnull"` // This status can be boosted/reblogged Boostable bool `validate:"-" bun:",notnull"` // This status can be boosted/reblogged

View file

@ -28,7 +28,7 @@ type Token struct {
ClientID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero,notnull"` // ID of the client who owns this token ClientID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero,notnull"` // ID of the client who owns this token
UserID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero"` // ID of the user who owns this token UserID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero"` // ID of the user who owns this token
RedirectURI string `validate:"required,uri" bun:",nullzero,notnull"` // Oauth redirect URI for this token RedirectURI string `validate:"required,uri" bun:",nullzero,notnull"` // Oauth redirect URI for this token
Scope string `validate:"required" bun:",nullzero,notnull"` // Oauth scope Scope string `validate:"required" bun:",notnull"` // Oauth scope
Code string `validate:"-" bun:",pk,nullzero,notnull,default:''"` // Code, if present Code string `validate:"-" bun:",pk,nullzero,notnull,default:''"` // Code, if present
CodeChallenge string `validate:"-" bun:",nullzero"` // Code challenge, if code present CodeChallenge string `validate:"-" bun:",nullzero"` // Code challenge, if code present
CodeChallengeMethod string `validate:"-" bun:",nullzero"` // Code challenge method, if code present CodeChallengeMethod string `validate:"-" bun:",nullzero"` // Code challenge method, if code present