refactor/fix: now using pgx errors for postgres error checking instead of trying to look up the error code;

feat: implemented working custom validation;
fix: authservice begin/complete registration
This commit is contained in:
2025-07-05 03:08:00 +03:00
parent 0a51727af8
commit 8319afc7ea
9 changed files with 126 additions and 39 deletions

View File

@@ -23,13 +23,13 @@ type Tokens struct {
}
type RegistrationBeginRequest struct {
Username string `json:"username" binding:"required,min=3,max=20"`
Username string `json:"username" binding:"required,min=3,max=20" validate:"username"`
Email *string `json:"email" binding:"email"`
Password string `json:"password" binding:"required"` // TODO: password checking
}
type RegistrationCompleteRequest struct {
Username string `json:"username" binding:"required,min=3,max=20"`
Username string `json:"username" binding:"required,min=3,max=20" validate:"username"`
VerificationCode string `json:"verification_code" binding:"required"`
Name string `json:"name" binding:"required,max=75"`
Birthday *string `json:"birthday"`
@@ -41,7 +41,7 @@ type RegistrationCompleteResponse struct {
}
type LoginRequest struct {
Username string `json:"username" binding:"required,min=3,max=20"`
Username string `json:"username" binding:"required,min=3,max=20" validate:"username"`
Password string `json:"password" binding:"required,max=100"`
TOTP *string `json:"totp"`
}