feat: new general and auth errors;

feat: NewPointer helper function in utils;
refactor: length validation in auth models
This commit is contained in:
2025-06-30 01:34:59 +03:00
parent e2d83aa779
commit 284d959bc3
4 changed files with 10 additions and 5 deletions

View File

@@ -28,9 +28,8 @@ type RegistrationBeginRequest struct {
Password string `json:"password" binding:"required"` // TODO: password checking
}
// TODO: length check
type RegistrationCompleteRequest struct {
Username string `json:"username" binding:"required"`
Username string `json:"username" binding:"required,min=3,max=20"`
VerificationCode string `json:"verification_code" binding:"required"`
Name string `json:"name" binding:"required,max=75"`
Birthday *string `json:"birthday"`
@@ -41,10 +40,9 @@ type RegistrationCompleteResponse struct {
Tokens
}
// TODO: length check
type LoginRequest struct {
Username string `json:"username" binding:"required"`
Password string `json:"password" binding:"required"`
Username string `json:"username" binding:"required,min=3,max=20"`
Password string `json:"password" binding:"required,max=100"`
TOTP *string `json:"totp"`
}