15357fd3c0
yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarba
40 lines
1.2 KiB
Go
40 lines
1.2 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type User struct {
|
|
ID uint `json:"id" gorm:"primarykey"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `json:"deleted_at,omitempty" gorm:"index"`
|
|
|
|
Name string `json:"name" gorm:"size:100;not null"`
|
|
Email string `json:"email" gorm:"size:255;uniqueIndex;not null"`
|
|
Password string `json:"-" gorm:"size:255;not null"` // Пароль не возвращаем в JSON
|
|
// OAuth провайдеры
|
|
OAuthProviders []OAuthProvider `json:"-"`
|
|
}
|
|
|
|
type CreateUserRequest struct {
|
|
Name string `json:"name" validate:"required,min=2,max=100"`
|
|
Email string `json:"email" validate:"required,email"`
|
|
Password string `json:"password" validate:"required,min=6"`
|
|
}
|
|
|
|
type UpdateUserRequest struct {
|
|
Name string `json:"name" validate:"omitempty,min=2,max=100"`
|
|
Email string `json:"email" validate:"omitempty,email"`
|
|
}
|
|
|
|
type UserResponse struct {
|
|
ID uint `json:"id"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
Name string `json:"name"`
|
|
Email string `json:"email"`
|
|
}
|