summaryrefslogtreecommitdiff
path: root/internal/gtsmodel/block.go
diff options
context:
space:
mode:
authorLibravatar tsmethurst <tobi.smethurst@protonmail.com>2021-08-31 15:59:12 +0200
committerLibravatar tsmethurst <tobi.smethurst@protonmail.com>2021-08-31 15:59:12 +0200
commitb95c80def6413df85ff53a5bcdbd553936c2d6e2 (patch)
treefa3fcc7e4bd2deaf371c324279fd6521ffb24445 /internal/gtsmodel/block.go
parentgo fmt (diff)
downloadgotosocial-b95c80def6413df85ff53a5bcdbd553936c2d6e2.tar.xz
change muchos things
Diffstat (limited to 'internal/gtsmodel/block.go')
-rw-r--r--internal/gtsmodel/block.go22
1 files changed, 8 insertions, 14 deletions
diff --git a/internal/gtsmodel/block.go b/internal/gtsmodel/block.go
index 0c762837d..989dd8193 100644
--- a/internal/gtsmodel/block.go
+++ b/internal/gtsmodel/block.go
@@ -4,18 +4,12 @@ import "time"
// Block refers to the blocking of one account by another.
type Block struct {
- // id of this block in the database
- ID string `bun:"type:CHAR(26),pk,notnull"`
- // When was this block created
- CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
- // When was this block updated
- UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
- // Who created this block?
- AccountID string `bun:"type:CHAR(26),notnull"`
- Account *Account `bun:"rel:belongs-to"`
- // Who is targeted by this block?
- TargetAccountID string `bun:"type:CHAR(26),notnull"`
- TargetAccount *Account `bun:"rel:belongs-to"`
- // Activitypub URI for this block
- URI string `bun:",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:",nullzero,notnull,default:current_timestamp"` // when was item created
+ UpdatedAt time.Time `validate:"-" bun:",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:frsrctarget,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:frsrctarget,notnull"` // Who is the target of this block ?
+ TargetAccount *Account `validate:"-" bun:"rel:belongs-to"` // Account corresponding to targetAccountID
}