summaryrefslogtreecommitdiff
path: root/internal/gtsmodel/domainblock.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-09-01 11:11:26 +0200
commit2786b5f88742c3f32b8ed497df3737cb4f57caec (patch)
treec088b71b228a52fb3bbf37628caea82ff7a42067 /internal/gtsmodel/domainblock.go
parentgo fmt (diff)
downloadgotosocial-2786b5f88742c3f32b8ed497df3737cb4f57caec.tar.xz
change muchos things
Diffstat (limited to 'internal/gtsmodel/domainblock.go')
-rw-r--r--internal/gtsmodel/domainblock.go29
1 files changed, 10 insertions, 19 deletions
diff --git a/internal/gtsmodel/domainblock.go b/internal/gtsmodel/domainblock.go
index 784e665a5..dd05ef0c6 100644
--- a/internal/gtsmodel/domainblock.go
+++ b/internal/gtsmodel/domainblock.go
@@ -22,23 +22,14 @@ import "time"
// DomainBlock represents a federation block against a particular domain
type DomainBlock struct {
- // ID of this block in the database
- ID string `bun:"type:CHAR(26),pk,notnull,unique"`
- // blocked domain
- Domain string `bun:",pk,notnull,unique"`
- // 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"`
- // Account ID of the creator of this block
- CreatedByAccountID string `bun:"type:CHAR(26),notnull"`
- CreatedByAccount *Account `bun:"rel:belongs-to"`
- // Private comment on this block, viewable to admins
- PrivateComment string `bun:",nullzero"`
- // Public comment on this block, viewable (optionally) by everyone
- PublicComment string `bun:",nullzero"`
- // whether the domain name should appear obfuscated when displaying it publicly
- Obfuscate bool
- // if this block was created through a subscription, what's the subscription ID?
- SubscriptionID string `bun:"type:CHAR(26),nullzero"`
+ 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
+ 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
+ SubscriptionID string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // if this block was created through a subscription, what's the subscription ID?
}