diff options
author | 2021-08-30 20:20:27 +0200 | |
---|---|---|
committer | 2021-09-01 11:11:26 +0200 | |
commit | 356d28fef9167ba1ec37ecc1a547196e78e56089 (patch) | |
tree | a06b67ecc9860ebf058c94aa10a6796393fc5b96 /internal/gtsmodel/user.go | |
parent | more work on struct validation (diff) | |
download | gotosocial-356d28fef9167ba1ec37ecc1a547196e78e56089.tar.xz |
more work on struct validation
Diffstat (limited to 'internal/gtsmodel/user.go')
-rw-r--r-- | internal/gtsmodel/user.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/internal/gtsmodel/user.go b/internal/gtsmodel/user.go index 4e7c4638a..85912d32b 100644 --- a/internal/gtsmodel/user.go +++ b/internal/gtsmodel/user.go @@ -39,28 +39,28 @@ type User struct { LastSignInAt time.Time `validate:"-" bun:",nullzero"` // When did this user last sign in? LastSignInIP net.IP `validate:"-" bun:",nullzero"` // What's the previous IP of this user? SignInCount int `validate:"-" bun:",nullzero,notnull,default:0"` // How many times has this user signed in? - InviteID string `validate:"ulid" bun:"type:CHAR(26),nullzero"` // id of the user who invited this user (who let this joker in?) + InviteID string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // id of the user who invited this user (who let this joker in?) ChosenLanguages []string `validate:"-" bun:",nullzero"` // What languages does this user want to see? FilteredLanguages []string `validate:"-" bun:",nullzero"` // What languages does this user not want to see? Locale string `validate:"-" bun:",nullzero"` // In what timezone/locale is this user located? - CreatedByApplicationID string `validate:"ulid" bun:"type:CHAR(26),nullzero,notnull"` // Which application id created this user? See gtsmodel.Application + CreatedByApplicationID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero,notnull"` // Which application id created this user? See gtsmodel.Application CreatedByApplication *Application `validate:"-" bun:"rel:belongs-to"` // Pointer to the application corresponding to createdbyapplicationID. LastEmailedAt time.Time `validate:"-" bun:",nullzero"` // When was this user last contacted by email. ConfirmationToken string `validate:"required_with=ConfirmationSentAt" bun:",nullzero"` // What confirmation token did we send this user/what are we expecting back? ConfirmationSentAt time.Time `validate:"required_with=ConfirmationToken" bun:",nullzero"` // When did we send email confirmation to this user? ConfirmedAt time.Time `validate:"required_with=Email" bun:",nullzero"` // When did the user confirm their email address UnconfirmedEmail string `validate:"required_without=Email" bun:",nullzero"` // Email address that hasn't yet been confirmed - Moderator bool `validate:"-" bun:",nullzero,notnull,default:false"` // Is this user a moderator? - Admin bool `validate:"-" bun:",nullzero,notnull,default:false"` // Is this user an admin? - Disabled bool `validate:"-" bun:",nullzero,notnull,default:false"` // Is this user disabled from posting? - Approved bool `validate:"-" bun:",nullzero,notnull,default:false"` // Has this user been approved by a moderator? + Moderator bool `validate:"-" bun:",notnull,default:false"` // Is this user a moderator? + Admin bool `validate:"-" bun:",notnull,default:false"` // Is this user an admin? + Disabled bool `validate:"-" bun:",notnull,default:false"` // Is this user disabled from posting? + Approved bool `validate:"-" bun:",notnull,default:false"` // Has this user been approved by a moderator? ResetPasswordToken string `validate:"required_with=ResetPasswordSentAt" bun:",nullzero"` // The generated token that the user can use to reset their password ResetPasswordSentAt time.Time `validate:"required_with=ResetPasswordToken" bun:",nullzero"` // When did we email the user their reset-password email? EncryptedOTPSecret string `validate:"-" bun:",nullzero"` EncryptedOTPSecretIv string `validate:"-" bun:",nullzero"` EncryptedOTPSecretSalt string `validate:"-" bun:",nullzero"` - OTPRequiredForLogin bool `validate:"-" bun:",nullzero"` + OTPRequiredForLogin bool `validate:"-" bun:",notnull,default:false"` OTPBackupCodes []string `validate:"-" bun:",nullzero"` ConsumedTimestamp int `validate:"-" bun:",nullzero"` RememberToken string `validate:"-" bun:",nullzero"` |