feat(auth): implement user registration endpoint

This commit is contained in:
2025-06-14 21:46:27 +03:00
parent 795f220e90
commit 54ce479a6e
8 changed files with 278 additions and 6 deletions

26
internal/models/user.go Normal file
View File

@@ -0,0 +1,26 @@
package models
import (
"time"
"github.com/google/uuid"
)
// User представляет структуру пользователя в таблице 'users'
type User struct {
ID int `json:"-"` // Скрываем в JSON
UUID uuid.UUID `json:"uuid"`
Username string `json:"username"`
Email string `json:"email"`
PasswordHash string `json:"-"` // Пароль никогда не отдаем
Role string `json:"role"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// RegisterRequest определяет структуру JSON-запроса на регистрацию
type RegisterRequest struct {
Username string `json:"username"`
Email string `json:"email"`
Password string `json:"password"`
}