more work on struct validation

This commit is contained in:
tsmethurst 2021-08-30 13:38:06 +02:00 committed by tsmethurst
commit dc2e1bf9ab
14 changed files with 455 additions and 144 deletions

View file

@ -20,18 +20,14 @@ 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:"required" bun:",nullzero,notnull,default:current_timestamp"` // when was item created
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
}