diff --git a/internal/gtsmodel/mediaattachment.go b/internal/gtsmodel/mediaattachment.go index 59cf8aac1..4c7e0f843 100644 --- a/internal/gtsmodel/mediaattachment.go +++ b/internal/gtsmodel/mediaattachment.go @@ -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 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) - 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 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 - 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 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 @@ -49,7 +49,7 @@ type MediaAttachment struct { type File struct { 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. - 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. } @@ -57,7 +57,7 @@ type File struct { type Thumbnail struct { 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. - 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. 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) diff --git a/internal/gtsmodel/status.go b/internal/gtsmodel/status.go index 38cb6e9c1..55488362e 100644 --- a/internal/gtsmodel/status.go +++ b/internal/gtsmodel/status.go @@ -29,7 +29,7 @@ type Status struct { 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 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 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 @@ -52,13 +52,13 @@ type Status struct { BoostOf *Status `validate:"-" bun:"-"` // status that corresponds to boostOfID BoostOfAccount *Account `validate:"-" bun:"rel:belongs-to"` // account that corresponds to boostOfAccountID 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? 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? 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!. - 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? 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 diff --git a/internal/gtsmodel/token.go b/internal/gtsmodel/token.go index 8058d9edf..25601dd01 100644 --- a/internal/gtsmodel/token.go +++ b/internal/gtsmodel/token.go @@ -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 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 - 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 CodeChallenge string `validate:"-" bun:",nullzero"` // Code challenge, if code present CodeChallengeMethod string `validate:"-" bun:",nullzero"` // Code challenge method, if code present