38 lines
1.5 KiB
Go
38 lines
1.5 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type User struct {
|
|
ID uuid.UUID `db:"id" json:"id"`
|
|
Email string `db:"email" json:"email"`
|
|
PasswordHash string `db:"password_hash" json:"-"`
|
|
FirstName string `db:"first_name" json:"first_name"`
|
|
SecondName string `db:"second_name" json:"second_name"`
|
|
BirthDate *time.Time `db:"birth_date" json:"birth_date,omitempty"`
|
|
Sex string `db:"sex" json:"sex"`
|
|
IsAdmin bool `db:"is_admin" json:"is_admin"`
|
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
|
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
|
}
|
|
|
|
type UserRegisterInput struct {
|
|
Email string `json:"email" binding:"required,min=3"`
|
|
Password string `json:"password" binding:"required,min=8"`
|
|
FirstName string `json:"first_name" binding:"required,min=2,max=64"`
|
|
SecondName string `json:"second_name" binding:"required,min=2,max=64"`
|
|
BirthDate *time.Time `json:"birth_date" binding:"omitempty"`
|
|
Sex string `json:"sex" binding:"required,oneof=MALE FEMALE"`
|
|
}
|
|
|
|
type UserUpdateInput struct {
|
|
FirstName string `json:"first_name" binding:"omitempty,min=2,max=64"`
|
|
SecondName string `json:"second_name" binding:"omitempty,min=2,max=64"`
|
|
BirthDate *time.Time `json:"birth_date"`
|
|
Sex string `json:"sex" binding:"omitempty,oneof=MALE FEMALE"`
|
|
Password string `json:"password" binding:"omitempty,min=8"`
|
|
}
|