gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 4c4a622088ef1db208930deb2d00cd1b2bcd708f
parent 41ace19e0c5a607e9535100d89e5d893eb93d2e7
Author: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>
Date:   Fri, 10 Sep 2021 09:08:21 +0100

Prune unnecessary nullzeros, fixup db tags (#200)

* prune gtsmodel.Account bun tags, add note to gtsmodel dir

Signed-off-by: kim (grufwub) <grufwub@gmail.com>

* further database tag fixes

Signed-off-by: kim (grufwub) <grufwub@gmail.com>

* more db tag fixups

Signed-off-by: kim (grufwub) <grufwub@gmail.com>

* fix removing nullzero for account timestamps...

Signed-off-by: kim (grufwub) <grufwub@gmail.com>

* add nullzero back to accountid tag

Signed-off-by: kim (grufwub) <grufwub@gmail.com>

* rename gtsmodel readme

Signed-off-by: kim (grufwub) <grufwub@gmail.com>
Diffstat:
Ainternal/gtsmodel/README.md | 8++++++++
Minternal/gtsmodel/account.go | 20++++++++++----------
Minternal/gtsmodel/application.go | 4++--
Minternal/gtsmodel/block.go | 16++++++++--------
Minternal/gtsmodel/domainblock.go | 6+++---
Minternal/gtsmodel/emoji.go | 2+-
Minternal/gtsmodel/follow.go | 20++++++++++----------
Minternal/gtsmodel/followrequest.go | 20++++++++++----------
Minternal/gtsmodel/instance.go | 10+++++-----
Minternal/gtsmodel/mediaattachment.go | 8++++----
Minternal/gtsmodel/status.go | 6+++---
Minternal/gtsmodel/token.go | 2+-
12 files changed, 65 insertions(+), 57 deletions(-)

diff --git a/internal/gtsmodel/README.md b/internal/gtsmodel/README.md @@ -0,0 +1,7 @@ +A note on when we should set data structures linked to objects in the database to use the +bun `nullzero` tag -- this should only be done if the member type is a pointer, or if the +this primitive type is literally invalid with an empty value (e.g. media IDs which when +empty signifies a null database value, compared to say an account note which when empty +could mean either an empty note OR null database value). + +Obviously it is a little more complex than this in practice, but keep it in mind! +\ No newline at end of file diff --git a/internal/gtsmodel/account.go b/internal/gtsmodel/account.go @@ -40,18 +40,18 @@ type Account struct { HeaderMediaAttachmentID string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // Database ID of the media attachment, if present HeaderMediaAttachment *MediaAttachment `validate:"-" bun:"rel:belongs-to"` // MediaAttachment corresponding to headerMediaAttachmentID HeaderRemoteURL string `validate:"omitempty,url" bun:",nullzero"` // For a non-local account, where can the header be fetched? - DisplayName string `validate:"-" bun:",nullzero"` // DisplayName for this account. Can be empty, then just the Username will be used for display purposes. + DisplayName string `validate:"-" bun:""` // DisplayName for this account. Can be empty, then just the Username will be used for display purposes. Fields []Field `validate:"-"` // a key/value map of fields that this account has added to their profile - Note string `validate:"-" bun:",nullzero"` // A note that this account has on their profile (ie., the account's bio/description of themselves) - Memorial bool `validate:"-" bun:",nullzero,default:false"` // Is this a memorial account, ie., has the user passed away? - AlsoKnownAs string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // This account is associated with x account id + Note string `validate:"-" bun:""` // A note that this account has on their profile (ie., the account's bio/description of themselves) + Memorial bool `validate:"-" bun:",default:false"` // Is this a memorial account, ie., has the user passed away? + AlsoKnownAs string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // This account is associated with x account id (TODO: migrate to be AlsoKnownAsID) MovedToAccountID string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // This account has moved this account id in the database - Bot bool `validate:"-" bun:",nullzero,default:false"` // Does this account identify itself as a bot? - Reason string `validate:"-" bun:",nullzero"` // What reason was given for signing up when this account was created? - Locked bool `validate:"-" bun:",nullzero,default:true"` // Does this account need an approval for new followers? - Discoverable bool `validate:"-" bun:",nullzero,default:false"` // Should this account be shown in the instance's profile directory? + Bot bool `validate:"-" bun:",default:false"` // Does this account identify itself as a bot? + Reason string `validate:"-" bun:""` // What reason was given for signing up when this account was created? + Locked bool `validate:"-" bun:",default:true"` // Does this account need an approval for new followers? + Discoverable bool `validate:"-" bun:",default:false"` // Should this account be shown in the instance's profile directory? Privacy Visibility `validate:"required_without=Domain,omitempty,oneof=public unlocked followers_only mutuals_only direct" bun:",nullzero"` // Default post privacy for this account - Sensitive bool `validate:"-" bun:",nullzero,default:false"` // Set posts from this account to sensitive by default? + Sensitive bool `validate:"-" bun:",default:false"` // Set posts from this account to sensitive by default? Language string `validate:"omitempty,bcp47_language_tag" bun:",nullzero,notnull,default:'en'"` // What language does this account post in? URI string `validate:"required,url" bun:",nullzero,notnull,unique"` // ActivityPub URI for this account. URL string `validate:"required_without=Domain,omitempty,url" bun:",nullzero,unique"` // Web URL for this account's profile @@ -68,7 +68,7 @@ type Account struct { SensitizedAt time.Time `validate:"-" bun:"type:timestamp,nullzero"` // When was this account set to have all its media shown as sensitive? SilencedAt time.Time `validate:"-" bun:"type:timestamp,nullzero"` // When was this account silenced (eg., statuses only visible to followers, not public)? SuspendedAt time.Time `validate:"-" bun:"type:timestamp,nullzero"` // When was this account suspended (eg., don't allow it to log in/post, don't accept media/posts from this account) - HideCollections bool `validate:"-" bun:",nullzero,default:false"` // Hide this account's collections + HideCollections bool `validate:"-" bun:",default:false"` // Hide this account's collections SuspensionOrigin string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // id of the database entry that caused this account to become suspended -- can be an account ID or a domain block ID } diff --git a/internal/gtsmodel/application.go b/internal/gtsmodel/application.go @@ -26,10 +26,10 @@ type Application struct { ID string `validate:"required,ulid" bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item last updated - Name string `validate:"required" bun:",nullzero,notnull"` // name of the application given when it was created (eg., 'tusky') + Name string `validate:"required" bun:",notnull"` // name of the application given when it was created (eg., 'tusky') Website string `validate:"omitempty,url" bun:",nullzero"` // website for the application given when it was created (eg., 'https://tusky.app') RedirectURI string `validate:"required,uri" bun:",nullzero,notnull"` // redirect uri requested by the application for oauth2 flow ClientID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero,notnull"` // id of the associated oauth client entity in the db ClientSecret string `validate:"required,uuid" bun:",nullzero,notnull"` // secret of the associated oauth client entity in the db - Scopes string `validate:"required" bun:",nullzero,notnull"` // scopes requested when this app was created + Scopes string `validate:"required" bun:",notnull"` // scopes requested when this app was created } diff --git a/internal/gtsmodel/block.go b/internal/gtsmodel/block.go @@ -22,12 +22,12 @@ import "time" // Block refers to the blocking of one account by another. type Block struct { - ID string `validate:"required,ulid" bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database - CreatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item created - UpdatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item last updated - URI string `validate:"required,url" bun:",notnull,nullzero,unique"` // ActivityPub uri of this block. - AccountID string `validate:"required,ulid" bun:"type:CHAR(26),unique:blocksrctarget,notnull"` // Who does this block originate from? - Account *Account `validate:"-" bun:"rel:belongs-to"` // Account corresponding to accountID - TargetAccountID string `validate:"required,ulid" bun:"type:CHAR(26),unique:blocksrctarget,notnull"` // Who is the target of this block ? - TargetAccount *Account `validate:"-" bun:"rel:belongs-to"` // Account corresponding to targetAccountID + ID string `validate:"required,ulid" bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database + CreatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item created + UpdatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item last updated + URI string `validate:"required,url" bun:",notnull,nullzero,unique"` // ActivityPub uri of this block. + AccountID string `validate:"required,ulid" bun:"type:CHAR(26),unique:blocksrctarget,notnull,nullzero"` // Who does this block originate from? + Account *Account `validate:"-" bun:"rel:belongs-to"` // Account corresponding to accountID + TargetAccountID string `validate:"required,ulid" bun:"type:CHAR(26),unique:blocksrctarget,notnull,nullzero"` // Who is the target of this block ? + TargetAccount *Account `validate:"-" bun:"rel:belongs-to"` // Account corresponding to targetAccountID } diff --git a/internal/gtsmodel/domainblock.go b/internal/gtsmodel/domainblock.go @@ -28,8 +28,8 @@ type DomainBlock struct { Domain string `validate:"required,fqdn" bun:",nullzero,notnull"` // domain to block. Eg. 'whatever.com' CreatedByAccountID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero,notnull"` // Account ID of the creator of this block CreatedByAccount *Account `validate:"-" bun:"rel:belongs-to"` // Account corresponding to createdByAccountID - PrivateComment string `validate:"-" bun:",nullzero"` // Private comment on this block, viewable to admins - PublicComment string `validate:"-" bun:",nullzero"` // Public comment on this block, viewable (optionally) by everyone - Obfuscate bool `validate:"-" bun:",nullzero,default:false"` // whether the domain name should appear obfuscated when displaying it publicly + PrivateComment string `validate:"-" bun:""` // Private comment on this block, viewable to admins + PublicComment string `validate:"-" bun:""` // Public comment on this block, viewable (optionally) by everyone + Obfuscate bool `validate:"-" bun:",default:false"` // whether the domain name should appear obfuscated when displaying it publicly SubscriptionID string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // if this block was created through a subscription, what's the subscription ID? } diff --git a/internal/gtsmodel/emoji.go b/internal/gtsmodel/emoji.go @@ -25,7 +25,7 @@ type Emoji struct { ID string `validate:"required,ulid" bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item last updated - Shortcode string `validate:"required" bun:",notnull,unique:shortcodedomain"` // String shortcode for this emoji -- the part that's between colons. This should be lowercase a-z_ eg., 'blob_hug' 'purple_heart' Must be unique with domain. + Shortcode string `validate:"required" bun:",nullzero,notnull,unique:shortcodedomain"` // String shortcode for this emoji -- the part that's between colons. This should be lowercase a-z_ eg., 'blob_hug' 'purple_heart' Must be unique with domain. Domain string `validate:"omitempty,fqdn" bun:",notnull,default:'',unique:shortcodedomain"` // Origin domain of this emoji, eg 'example.org', 'queer.party'. empty string for local emojis. ImageRemoteURL string `validate:"required_without=ImageURL,omitempty,url" bun:",nullzero"` // Where can this emoji be retrieved remotely? Null for local emojis. ImageStaticRemoteURL string `validate:"required_without=ImageStaticURL,omitempty,url" bun:",nullzero"` // Where can a static / non-animated version of this emoji be retrieved remotely? Null for local emojis. diff --git a/internal/gtsmodel/follow.go b/internal/gtsmodel/follow.go @@ -22,14 +22,14 @@ import "time" // Follow represents one account following another, and the metadata around that follow. type Follow struct { - ID string `validate:"required,ulid" bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database - CreatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item created - UpdatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item last updated - URI string `validate:"required,url" bun:",notnull,nullzero,unique"` // ActivityPub uri of this follow. - AccountID string `validate:"required,ulid" bun:"type:CHAR(26),unique:srctarget,notnull"` // Who does this follow originate from? - Account *Account `validate:"-" bun:"rel:belongs-to"` // Account corresponding to accountID - TargetAccountID string `validate:"required,ulid" bun:"type:CHAR(26),unique:srctarget,notnull"` // Who is the target of this follow ? - TargetAccount *Account `validate:"-" bun:"rel:belongs-to"` // Account corresponding to targetAccountID - ShowReblogs bool `validate:"-" bun:",nullzero,default:true"` // Does this follow also want to see reblogs and not just posts? - Notify bool `validate:"-" bun:",nullzero,default:false"` // does the following account want to be notified when the followed account posts? + ID string `validate:"required,ulid" bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database + CreatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item created + UpdatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item last updated + URI string `validate:"required,url" bun:",notnull,nullzero,unique"` // ActivityPub uri of this follow. + AccountID string `validate:"required,ulid" bun:"type:CHAR(26),unique:srctarget,notnull,nullzero"` // Who does this follow originate from? + Account *Account `validate:"-" bun:"rel:belongs-to"` // Account corresponding to accountID + TargetAccountID string `validate:"required,ulid" bun:"type:CHAR(26),unique:srctarget,notnull,nullzero"` // Who is the target of this follow ? + TargetAccount *Account `validate:"-" bun:"rel:belongs-to"` // Account corresponding to targetAccountID + ShowReblogs bool `validate:"-" bun:",default:true"` // Does this follow also want to see reblogs and not just posts? + Notify bool `validate:"-" bun:",default:false"` // does the following account want to be notified when the followed account posts? } diff --git a/internal/gtsmodel/followrequest.go b/internal/gtsmodel/followrequest.go @@ -22,14 +22,14 @@ import "time" // FollowRequest represents one account requesting to follow another, and the metadata around that request. type FollowRequest struct { - ID string `validate:"required,ulid" bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database - CreatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item created - UpdatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item last updated - URI string `validate:"required,url" bun:",notnull,nullzero,unique"` // ActivityPub uri of this follow (request). - AccountID string `validate:"required,ulid" bun:"type:CHAR(26),unique:frsrctarget,notnull"` // Who does this follow request originate from? - Account *Account `validate:"-" bun:"rel:belongs-to"` // Account corresponding to accountID - TargetAccountID string `validate:"required,ulid" bun:"type:CHAR(26),unique:frsrctarget,notnull"` // Who is the target of this follow request? - TargetAccount *Account `validate:"-" bun:"rel:belongs-to"` // Account corresponding to targetAccountID - ShowReblogs bool `validate:"-" bun:",nullzero,default:true"` // Does this follow also want to see reblogs and not just posts? - Notify bool `validate:"-" bun:",nullzero,default:false"` // does the following account want to be notified when the followed account posts? + ID string `validate:"required,ulid" bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database + CreatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item created + UpdatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item last updated + URI string `validate:"required,url" bun:",notnull,nullzero,unique"` // ActivityPub uri of this follow (request). + AccountID string `validate:"required,ulid" bun:"type:CHAR(26),unique:frsrctarget,notnull,nullzero"` // Who does this follow request originate from? + Account *Account `validate:"-" bun:"rel:belongs-to"` // Account corresponding to accountID + TargetAccountID string `validate:"required,ulid" bun:"type:CHAR(26),unique:frsrctarget,notnull,nullzero"` // Who is the target of this follow request? + TargetAccount *Account `validate:"-" bun:"rel:belongs-to"` // Account corresponding to targetAccountID + ShowReblogs bool `validate:"-" bun:",default:true"` // Does this follow also want to see reblogs and not just posts? + Notify bool `validate:"-" bun:",default:false"` // does the following account want to be notified when the followed account posts? } diff --git a/internal/gtsmodel/instance.go b/internal/gtsmodel/instance.go @@ -26,15 +26,15 @@ type Instance struct { CreatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item last updated Domain string `validate:"required,fqdn" bun:",nullzero,notnull,unique"` // Instance domain eg example.org - Title string `validate:"-" bun:",nullzero"` // Title of this instance as it would like to be displayed. + Title string `validate:"-" bun:""` // Title of this instance as it would like to be displayed. URI string `validate:"required,url" bun:",nullzero,notnull,unique"` // base URI of this instance eg https://example.org SuspendedAt time.Time `validate:"-" bun:"type:timestamp,nullzero"` // When was this instance suspended, if at all? DomainBlockID string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // ID of any existing domain block for this instance in the database DomainBlock *DomainBlock `validate:"-" bun:"rel:belongs-to"` // Domain block corresponding to domainBlockID - ShortDescription string `validate:"-" bun:",nullzero"` // Short description of this instance - Description string `validate:"-" bun:",nullzero"` // Longer description of this instance - Terms string `validate:"-" bun:",nullzero"` // Terms and conditions of this instance - ContactEmail string `validate:"omitempty,email" bun:",nullzero"` // Contact email address for this instance + ShortDescription string `validate:"-" bun:""` // Short description of this instance + Description string `validate:"-" bun:""` // Longer description of this instance + Terms string `validate:"-" bun:""` // Terms and conditions of this instance + ContactEmail string `validate:"omitempty,email" bun:""` // Contact email address for this instance ContactAccountUsername string `validate:"required_with=ContactAccountID" bun:",nullzero"` // Username of the contact account for this instance ContactAccountID string `validate:"required_with=ContactAccountUsername,omitempty,ulid" bun:"type:CHAR(26),nullzero"` // Contact account ID in the database for this instance ContactAccount *Account `validate:"-" bun:"rel:belongs-to"` // account corresponding to contactAccountID diff --git 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 @@ -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 @@ -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