feat: API replicas over HAProxy (3)

This commit is contained in:
2026-11-06 03:26:54 +03:00
parent de2f63b926
commit ec111aadfb
32 changed files with 396 additions and 147 deletions
+4
View File
@@ -2,6 +2,7 @@ package service
import (
"context"
"errors"
"fmt"
"regexp"
"unicode/utf8"
@@ -49,6 +50,9 @@ func (s *UserService) Register(ctx context.Context, username, displayName, passw
CreatedAt: now(),
}
if err := s.repo.CreateUser(ctx, u, hash); err != nil {
if errors.Is(err, domain.ErrConflict) {
return domain.User{}, fmt.Errorf("%w: username is already taken", domain.ErrConflict)
}
return domain.User{}, err
}
return u, nil