feat(app) lab 3 implemented

This commit is contained in:
imadev
2026-10-30 18:11:30 +03:00
parent f731f9b460
commit 48a616e910
57 changed files with 1390 additions and 303 deletions
+2 -5
View File
@@ -5,8 +5,8 @@ import (
"errors"
"time"
"gitflic.ru/project/bulla-max/mtusi2026lab2/internal/common"
"gitflic.ru/project/bulla-max/mtusi2026lab2/internal/model"
"gitflic.ru/project/bulla-max/mtusi2026lab/internal/common"
"gitflic.ru/project/bulla-max/mtusi2026lab/internal/model"
"github.com/google/uuid"
"github.com/jackc/pgx/v5"
)
@@ -28,9 +28,6 @@ func (s *Store) CreateUser(ctx context.Context, username, displayName, passwordH
VALUES ($1, $2, $3, $4, $5)`,
user.ID, user.Username, user.DisplayName, user.PasswordHash, time.Time(user.CreatedAt))
if err != nil {
// AGENT: The unique index is the real guard. Two concurrent registrations
// with the same username both reach INSERT; exactly one commits, the other
// gets SQLSTATE 23505 and is mapped to 409 instead of a 500.
if isUniqueViolation(err) {
return model.User{}, common.Conflict("username already taken")
}