diff options
| author | 2021-09-03 10:27:40 +0100 | |
|---|---|---|
| committer | 2021-09-03 10:27:40 +0100 | |
| commit | 25edd57eaf3eecf0b449a4dabb5b5fc5d6ae7687 (patch) | |
| tree | b6cffb65d46a07f59d5393a257973910d4116227 /internal/gtsmodel/statusbookmark.go | |
| parent | session name fix (#185) (diff) | |
| parent | review changes (diff) | |
| download | gotosocial-25edd57eaf3eecf0b449a4dabb5b5fc5d6ae7687.tar.xz | |
Merge pull request #186 from superseriousbusiness/struct_validation
Struct validation
Diffstat (limited to 'internal/gtsmodel/statusbookmark.go')
| -rw-r--r-- | internal/gtsmodel/statusbookmark.go | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/internal/gtsmodel/statusbookmark.go b/internal/gtsmodel/statusbookmark.go index 26dafa420..3dcf4cb92 100644 --- a/internal/gtsmodel/statusbookmark.go +++ b/internal/gtsmodel/statusbookmark.go @@ -20,18 +20,15 @@ package gtsmodel import "time" -// StatusBookmark refers to one account having a 'bookmark' of the status of another account +// StatusBookmark refers to one account having a 'bookmark' of the status of another account. type StatusBookmark struct { - // id of this bookmark in the database - ID string `bun:"type:CHAR(26),pk,notnull,unique"` - // when was this bookmark created - CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"` - // id of the account that created ('did') the bookmarking - AccountID string `bun:"type:CHAR(26),notnull"` - Account *Account `bun:"rel:belongs-to"` - // id the account owning the bookmarked status - TargetAccountID string `bun:"type:CHAR(26),notnull"` - TargetAccount *Account `bun:"rel:belongs-to"` - // database id of the status that has been bookmarked - StatusID string `bun:"type:CHAR(26),notnull"` + 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 + AccountID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero,notnull"` // id of the account that created ('did') the bookmark + Account *Account `validate:"-" bun:"rel:belongs-to"` // account that created the bookmark + TargetAccountID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero,notnull"` // id the account owning the bookmarked status + TargetAccount *Account `validate:"-" bun:"rel:belongs-to"` // account owning the bookmarked status + StatusID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero,notnull"` // database id of the status that has been bookmarked + Status *Status `validate:"-" bun:"rel:belongs-to"` // the bookmarked status } |
