feat: game lobby service

This commit is contained in:
Ilia Denisov
2026-04-25 23:20:55 +02:00
committed by GitHub
parent 32dc29359a
commit 48b0056b49
336 changed files with 57074 additions and 1418 deletions
+21 -5
View File
@@ -6,6 +6,7 @@ import (
"time"
"galaxy/user/internal/domain/common"
"galaxy/util"
"golang.org/x/text/language"
)
@@ -36,14 +37,29 @@ func ParseUserID(value string) (common.UserID, error) {
return userID, nil
}
// ParseRaceName trims value and validates it as one exact stored race name.
func ParseRaceName(value string) (common.RaceName, error) {
raceName := common.RaceName(NormalizeString(value))
if err := raceName.Validate(); err != nil {
// ParseUserName trims value and validates it as one exact stored user name.
func ParseUserName(value string) (common.UserName, error) {
userName := common.UserName(NormalizeString(value))
if err := userName.Validate(); err != nil {
return "", InvalidRequest(err.Error())
}
return raceName, nil
return userName, nil
}
// ParseDisplayName trims value and validates it as one self-service display
// name. An empty trimmed value is accepted and represents a reset to no
// display name.
func ParseDisplayName(value string) (common.DisplayName, error) {
trimmed := NormalizeString(value)
if trimmed == "" {
return "", nil
}
if _, ok := util.ValidateTypeName(trimmed); !ok {
return "", InvalidRequest(fmt.Sprintf("display_name %q is invalid", trimmed))
}
return common.DisplayName(trimmed), nil
}
// ParseReasonCode trims value and validates it as one machine-readable reason