Files
online-backend/internal/identity/auth/dto.go
GuwandykA 8795ae2195 Put the user's role and branch on GET /profile, upsert role_user and branch_user on POST, and drop their list endpoints.
Also accept flexible card-order form values, move mock seed under db/mock, and regenerate Swagger.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-22 17:56:07 +05:00

104 lines
2.5 KiB
Go
Executable File

package auth
import "time"
type LoginDTO struct {
Name string `json:"name"`
Phone string `json:"phone"`
Password string `json:"password" binding:"required"`
}
type RefreshTokenDTO struct {
RefreshToken string `json:"refreshToken" binding:"required"`
}
type LocalizedText struct {
En string `json:"en"`
Ru string `json:"ru"`
Tm string `json:"tm"`
}
type ProfileRoleDTO struct {
Id int64 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
}
type ProfileBranchDTO struct {
Id int64 `json:"id"`
UniqueCode string `json:"uniqueCode"`
Name LocalizedText `json:"name"`
}
type UserProfileDTO struct {
Id int `json:"id"`
Name string `json:"name"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Phone string `json:"phone"`
Avatar string `json:"avatar"`
Role *ProfileRoleDTO `json:"role"`
Branches []ProfileBranchDTO `json:"branches"`
CreatedAt time.Time `json:"createdAt"`
}
type UpdateProfileDTO struct {
Name string `json:"name" binding:"required"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Phone string `json:"phone"`
Avatar string `json:"avatar"`
}
type UserCredentials struct {
Id int
Password string
}
type RegisterDTO struct {
Name string `json:"name" binding:"required"`
Phone string `json:"phone" binding:"required"`
Username string `json:"username" binding:"required,min=3"`
Password string `json:"password" binding:"required,min=6"`
PasswordConfirm string `json:"passwordConfirm" binding:"required"`
}
type VerifyDTO struct {
Phone string `json:"phone" binding:"required"`
Code string `json:"code" binding:"required,len=6"`
}
type ForgotPasswordDTO struct {
Name string `json:"name" binding:"required"`
}
type ResetPasswordDTO struct {
Name string `json:"name" binding:"required"`
Code string `json:"code" binding:"required,len=6"`
Password string `json:"password" binding:"required,min=6"`
PasswordConfirm string `json:"passwordConfirm" binding:"required"`
}
type UserIdentity struct {
Id int
Name string
Username string
Phone string
}
type RegisterResult struct {
Phone string `json:"phone"`
ExpiresIn int `json:"expiresIn"`
}
type Verification struct {
ID int64
Name string
Username string
Phone string
Password string
CodeHash string
Attempts int
ExpiresAt time.Time
}