59 lines
1.8 KiB
Go
59 lines
1.8 KiB
Go
package auth
|
|
|
|
type RegisterRequest struct {
|
|
Name string `json:"name" binding:"required,min=2,max=100"`
|
|
Email string `json:"email" binding:"required,email,max=150"`
|
|
Password string `json:"password" binding:"required,min=6"`
|
|
ConfirmPassword string `json:"confirm_password" binding:"required,eqfield=Password"`
|
|
}
|
|
|
|
type LoginRequest struct {
|
|
Email string `json:"email" binding:"required,email"`
|
|
Password string `json:"password" binding:"required"`
|
|
}
|
|
|
|
type GoogleLoginRequest struct {
|
|
IDToken string `json:"id_token" binding:"required"`
|
|
}
|
|
|
|
type VerifyEmailRequest struct {
|
|
Token string `json:"token" binding:"required"`
|
|
}
|
|
|
|
type ForgotPasswordRequest struct {
|
|
Email string `json:"email" binding:"required,email"`
|
|
}
|
|
|
|
type ResetPasswordRequest struct {
|
|
Token string `json:"token" binding:"required"`
|
|
NewPassword string `json:"new_password" binding:"required,min=6"`
|
|
ConfirmNewPassword string `json:"confirm_new_password" binding:"required,eqfield=NewPassword"`
|
|
}
|
|
|
|
type RefreshTokenRequest struct {
|
|
RefreshToken string `json:"refresh_token" binding:"required"`
|
|
}
|
|
|
|
type LogoutRequest struct {
|
|
RefreshToken string `json:"refresh_token" binding:"required"`
|
|
}
|
|
|
|
type LoginResponse struct {
|
|
AccessToken string `json:"access_token"`
|
|
RefreshToken string `json:"refresh_token"`
|
|
User struct {
|
|
ID uint `json:"id"`
|
|
Name string `json:"name"`
|
|
Email string `json:"email"`
|
|
AvatarURL *string `json:"avatar_url,omitempty"`
|
|
Role string `json:"role"`
|
|
Status string `json:"status"`
|
|
IsEmailVerified bool `json:"is_email_verified"`
|
|
} `json:"user"`
|
|
}
|
|
|
|
type TokenResponse struct {
|
|
AccessToken string `json:"access_token"`
|
|
RefreshToken string `json:"refresh_token"`
|
|
}
|