auth, user, userbranch and org/branches each declared their own identical
{en, ru, tm} struct; they now use shared.LocalizedText. No JSON change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
112 lines
2.9 KiB
Go
Executable File
112 lines
2.9 KiB
Go
Executable File
package auth
|
|
|
|
import (
|
|
"time"
|
|
|
|
"online-back/internal/shared"
|
|
)
|
|
|
|
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 ProfileRoleDTO struct {
|
|
Id int64 `json:"id"`
|
|
Code string `json:"code"`
|
|
Name string `json:"name"`
|
|
Scope string `json:"scope"`
|
|
IsSuper bool `json:"isSuper"`
|
|
}
|
|
|
|
type ProfileBranchDTO struct {
|
|
Id int64 `json:"id"`
|
|
UniqueCode string `json:"uniqueCode"`
|
|
Name shared.LocalizedText `json:"name"`
|
|
}
|
|
|
|
// ProfilePermissionDTO is one module the caller can open; the front-end
|
|
// builds its menu from this list.
|
|
type ProfilePermissionDTO struct {
|
|
Code string `json:"code"`
|
|
Name string `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"`
|
|
Permissions []ProfilePermissionDTO `json:"permissions"`
|
|
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
|
|
}
|