This commit is contained in:
2026-08-03 00:49:27 +07:00
parent c32a11d124
commit 051b3e8bee
6 changed files with 29 additions and 36 deletions
+4 -6
View File
@@ -32,7 +32,7 @@ func (r *TeamsRepo) GetTeamByID(ctx context.Context, id int) (*repos.Team, error
name,
status,
password,
scenario_id
game_id
FROM teams
WHERE id = $1`,
id,
@@ -42,7 +42,7 @@ func (r *TeamsRepo) GetTeamByID(ctx context.Context, id int) (*repos.Team, error
&team.Name,
&team.Status,
&team.Password,
&team.ScenarioId,
&team.GameId,
)
if err != nil {
if errors.Is(err, pgx.ErrNoRows) {
@@ -101,19 +101,17 @@ func (r *TeamsRepo) AddTeam(
creatorId int,
gameId int,
name string,
scenarioId int,
password string,
) (int, error) {
id := 0
err := r.pool.QueryRow(
ctx,
`INSERT INTO teams (name, creator_id, game_id, scenario_id, password)
VALUES ($1, $2, $3, $4, $5)
`INSERT INTO teams (name, creator_id, game_id, password)
VALUES ($1, $2, $3, $4)
RETURNING id`,
name,
creatorId,
gameId,
scenarioId,
password,
).Scan(&id)