From c1375ca5c1d5a8a645151cedfced5a336f6b7467 Mon Sep 17 00:00:00 2001 From: Daenney Date: Sun, 6 Aug 2023 12:22:40 +0200 Subject: [chore] Remove go-playground/validator (#2069) * [chore] Remove go-playground/validator It turns out we're not actually using the validator code. This is a remnant from when we intended to use it, but the presence of it and its struct tags creates the illusion we're validating a lot of things we're not. It resulted in some confusion when we were trying to figure out language valdiation. Remove all this code, so that only the validation functions from the validate package we actually use remain. I'm not touching the struct tags in the migrations in order to avoid things potentially thinking migrations need to be re-run. * [chore] Bring back a struct tag on api The validate on internal/api is Gin doing form validation, not the validator from go-playground/validator. --- internal/gtsmodel/statusfave.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'internal/gtsmodel/statusfave.go') diff --git a/internal/gtsmodel/statusfave.go b/internal/gtsmodel/statusfave.go index 86096ef5e..f81226f8b 100644 --- a/internal/gtsmodel/statusfave.go +++ b/internal/gtsmodel/statusfave.go @@ -21,14 +21,14 @@ import "time" // StatusFave refers to a 'fave' or 'like' in the database, from one account, targeting the status of another account type StatusFave struct { - 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:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created - UpdatedAt time.Time `validate:"-" bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated - AccountID string `validate:"required,ulid" bun:"type:CHAR(26),unique:statusfaveaccountstatus,nullzero,notnull"` // id of the account that created ('did') the fave - Account *Account `validate:"-" bun:"-"` // account that created the fave - TargetAccountID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero,notnull"` // id the account owning the faved status - TargetAccount *Account `validate:"-" bun:"-"` // account owning the faved status - StatusID string `validate:"required,ulid" bun:"type:CHAR(26),unique:statusfaveaccountstatus,nullzero,notnull"` // database id of the status that has been 'faved' - Status *Status `validate:"-" bun:"-"` // the faved status - URI string `validate:"required,url" bun:",nullzero,notnull,unique"` // ActivityPub URI of this fave + ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database + CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created + UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated + AccountID string `bun:"type:CHAR(26),unique:statusfaveaccountstatus,nullzero,notnull"` // id of the account that created ('did') the fave + Account *Account `bun:"-"` // account that created the fave + TargetAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // id the account owning the faved status + TargetAccount *Account `bun:"-"` // account owning the faved status + StatusID string `bun:"type:CHAR(26),unique:statusfaveaccountstatus,nullzero,notnull"` // database id of the status that has been 'faved' + Status *Status `bun:"-"` // the faved status + URI string `bun:",nullzero,notnull,unique"` // ActivityPub URI of this fave } -- cgit v1.2.3