From 617baa5cfff914dc2dbd53d65775822caf87ec20 Mon Sep 17 00:00:00 2001 From: Kichiyaki Date: Wed, 4 Aug 2021 07:49:52 +0200 Subject: [PATCH] remove unnecessary fields from user model (ActivationToken, ActivationTokenGeneratedAt, ResetPasswordToken, ResetPasswordTokenGeneratedAt) --- internal/model/user.go | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/internal/model/user.go b/internal/model/user.go index 0cba6a7..653dc21 100644 --- a/internal/model/user.go +++ b/internal/model/user.go @@ -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) {