feat: add data validation and structured logging

This commit is contained in:
2026-01-05 18:24:11 +03:00
parent 9bf2a15045
commit 9e2657c709
7 changed files with 122 additions and 27 deletions

View File

@@ -9,8 +9,8 @@ type Agent struct {
// AuthenticateRequest - это тело запроса на /authserver/authenticate
type AuthenticateRequest struct {
Agent Agent `json:"agent"`
Username string `json:"username"`
Password string `json:"password"`
Username string `json:"username" validate:"required"`
Password string `json:"password" validate:"required"`
ClientToken string `json:"clientToken"`
}
@@ -70,15 +70,15 @@ type SessionProfileResponse struct {
// JoinRequest - это тело запроса на /sessionserver/session/minecraft/join
type JoinRequest struct {
AccessToken string `json:"accessToken"`
SelectedProfile string `json:"selectedProfile"` // UUID пользователя без дефисов
ServerID string `json:"serverId"`
AccessToken string `json:"accessToken" validate:"required"`
SelectedProfile string `json:"selectedProfile" validate:"required"` // UUID пользователя без дефисов
ServerID string `json:"serverId" validate:"required"`
}
// LoginRequest - это тело запроса на /api/login
type LoginRequest struct {
Login string `json:"login"`
Password string `json:"password"`
Login string `json:"login" validate:"required"`
Password string `json:"password" validate:"required"`
}
// LoginResponse - это тело успешного ответа с JWT