63 lines
1.6 KiB
Go
63 lines
1.6 KiB
Go
// AngelaMos | 2026
|
|
// dto.go
|
|
|
|
package auth
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type LoginRequest struct {
|
|
Email string `json:"email" validate:"required,email,max=255"`
|
|
Password string `json:"password" validate:"required,min=8,max=128"`
|
|
}
|
|
|
|
type RegisterRequest struct {
|
|
Email string `json:"email" validate:"required,email,max=255"`
|
|
Password string `json:"password" validate:"required,min=8,max=128"`
|
|
Name string `json:"name" validate:"required,min=1,max=100"`
|
|
}
|
|
|
|
type RefreshRequest struct {
|
|
RefreshToken string `json:"refresh_token,omitempty"`
|
|
}
|
|
|
|
type TokenResponse struct {
|
|
AccessToken string `json:"access_token"`
|
|
RefreshToken string `json:"refresh_token"`
|
|
TokenType string `json:"token_type"`
|
|
ExpiresIn int `json:"expires_in"`
|
|
ExpiresAt time.Time `json:"expires_at"`
|
|
}
|
|
|
|
type UserResponse struct {
|
|
ID string `json:"id"`
|
|
Email string `json:"email"`
|
|
Name string `json:"name"`
|
|
Role string `json:"role"`
|
|
Tier string `json:"tier"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type AuthResponse struct {
|
|
User UserResponse `json:"user"`
|
|
Tokens TokenResponse `json:"tokens"`
|
|
}
|
|
|
|
type SessionInfo struct {
|
|
ID string `json:"id"`
|
|
UserAgent string `json:"user_agent"`
|
|
IPAddress string `json:"ip_address"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
ExpiresAt time.Time `json:"expires_at"`
|
|
}
|
|
|
|
type SessionsResponse struct {
|
|
Sessions []SessionInfo `json:"sessions"`
|
|
}
|
|
|
|
type ChangePasswordRequest struct {
|
|
CurrentPassword string `json:"current_password" validate:"required"`
|
|
NewPassword string `json:"new_password" validate:"required,min=8,max=128"`
|
|
}
|