7335eb5aa8
modified: main_dc/yalarba/api_tp/internal/handlers/oauth.go modified: main_dc/yalarba/api_tp/internal/handlers/oauth_yandex.go modified: main_dc/yalarba/api_tp/internal/models/user.go modified: main_dc/yalarba/api_tp/internal/repository/user_repository.go modified: main_dc/yalarba/api_tp/internal/service/user_service.go modified: main_dc/yalarba/api_tp/internal/utils/oauth_utils.go modified: main_dc/yalarba/api_tp/pkg/database/postgres.go change naming for user into api
40 lines
1.2 KiB
Go
40 lines
1.2 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type UserT 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"`
|
|
}
|