summaryrefslogtreecommitdiff
path: root/internal/gtsmodel/statusmute.go
diff options
context:
space:
mode:
authorLibravatar tsmethurst <tobi.smethurst@klarrio.com>2021-08-29 16:52:23 +0200
committerLibravatar tsmethurst <tobi.smethurst@protonmail.com>2021-09-01 11:11:26 +0200
commitd2276fc553332477740e2c320d51a9cbc3cf2585 (patch)
treee02e1433afeedbd442d8d9202ddad8a1261b549e /internal/gtsmodel/statusmute.go
parentImprove GetRemoteStatus and db.GetStatus() logic (#174) (diff)
downloadgotosocial-d2276fc553332477740e2c320d51a9cbc3cf2585.tar.xz
start working on struct validation for gtsmodel
Diffstat (limited to 'internal/gtsmodel/statusmute.go')
-rw-r--r--internal/gtsmodel/statusmute.go23
1 files changed, 9 insertions, 14 deletions
diff --git a/internal/gtsmodel/statusmute.go b/internal/gtsmodel/statusmute.go
index 56a792ab4..90eb41bdb 100644
--- a/internal/gtsmodel/statusmute.go
+++ b/internal/gtsmodel/statusmute.go
@@ -20,19 +20,14 @@ package gtsmodel
import "time"
-// StatusMute refers to one account having muted the status of another account or its own
+// StatusMute refers to one account having muted the status of another account or its own.
type StatusMute struct {
- // id of this mute in the database
- ID string `bun:"type:CHAR(26),pk,notnull,unique"`
- // when was this mute created
- CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
- // id of the account that created ('did') the mute
- AccountID string `bun:"type:CHAR(26),notnull"`
- Account *Account `bun:"rel:belongs-to"`
- // id the account owning the muted status (can be the same as accountID)
- TargetAccountID string `bun:"type:CHAR(26),notnull"`
- TargetAccount *Account `bun:"rel:belongs-to"`
- // database id of the status that has been muted
- StatusID string `bun:"type:CHAR(26),notnull"`
- Status *Status `bun:"rel:belongs-to"`
+ 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 mute
+ Account *Account `validate:"-" bun:"rel:belongs-to"` // pointer to the account specified by accountID
+ TargetAccountID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero,notnull"` // id the account owning the muted status (can be the same as accountID)
+ TargetAccount *Account `validate:"-" bun:"rel:belongs-to"` // pointer to the account specified by targetAccountID
+ StatusID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero,notnull"` // database id of the status that has been muted
+ Status *Status `validate:"-" bun:"rel:belongs-to"` // pointer to the muted status specified by statusID
}