Merge pull request #26 from zdam-egzamin-zawodowy/remove-unnecessary-fields-from-user-model

remove unnecessary fields from user model
This commit is contained in:
Dawid Wysokiński 2021-08-04 07:55:09 +02:00 committed by GitHub
commit 39e46f1f6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 11 deletions

View File

@ -17,17 +17,13 @@ var _ pg.BeforeInsertHook = (*User)(nil)
type User struct {
tableName struct{} `pg:"alias:user"`
ID int `json:"id" pg:",pk" xml:"id" gqlgen:"id"`
DisplayName string `json:"displayName" pg:",use_zero,notnull" xml:"displayName" gqlgen:"displayName"`
Password string `json:"-" gqlgen:"-" xml:"password"`
Email string `json:"email" pg:",unique" xml:"email" gqlgen:"email"`
CreatedAt time.Time `json:"createdAt" pg:"default:now()" xml:"createdAt" gqlgen:"createdAt"`
Role Role `json:"role" xml:"role" gqlgen:"role"`
Activated *bool `json:"activated" pg:"default:false,use_zero" xml:"activated" gqlgen:"activated"`
ActivationToken string `json:"-" gqlgen:"-" xml:"activationToken"`
ActivationTokenGeneratedAt time.Time `json:"-" gqlgen:"-" pg:"default:now()" xml:"activationTokenGeneratedAt"`
ResetPasswordToken string `json:"-" gqlgen:"-" xml:"resetPasswordToken"`
ResetPasswordTokenGeneratedAt time.Time `json:"-" gqlgen:"-" pg:"default:now()" xml:"resetPasswordTokenGeneratedAt"`
ID int `json:"id" pg:",pk" xml:"id" gqlgen:"id"`
DisplayName string `json:"displayName" pg:",use_zero,notnull" xml:"displayName" gqlgen:"displayName"`
Password string `json:"-" gqlgen:"-" xml:"password"`
Email string `json:"email" pg:",unique" xml:"email" gqlgen:"email"`
CreatedAt time.Time `json:"createdAt" pg:"default:now()" xml:"createdAt" gqlgen:"createdAt"`
Role Role `json:"role" xml:"role" gqlgen:"role"`
Activated *bool `json:"activated" pg:"default:false,use_zero" xml:"activated" gqlgen:"activated"`
}
func (u *User) BeforeInsert(ctx context.Context) (context.Context, error) {