add location

This commit is contained in:
2026-09-18 16:01:02 +07:00
parent fc171dace5
commit 32191529a5
15 changed files with 106 additions and 21 deletions
+15 -6
View File
@@ -28,6 +28,7 @@ func (r *GamesRepo) AddGame(
ctx context.Context,
name string,
description string,
location *string,
startAt time.Time,
scenarioId int32,
format string,
@@ -35,11 +36,12 @@ func (r *GamesRepo) AddGame(
id := 0
err := r.pool.QueryRow(
ctx,
`INSERT INTO games (name, description, start_at, scenario_id, format)
VALUES ($1, $2, $3, $4, $5)
`INSERT INTO games (name, description, location, start_at, scenario_id, format)
VALUES ($1, $2, $3, $4, $5, $6)
RETURNING id`,
name,
description,
location,
startAt,
scenarioId,
format,
@@ -62,6 +64,7 @@ func (r *GamesRepo) GetGameByID(
games.id,
games.name,
games.description,
games.location,
games.start_at,
games.format,
games.status,
@@ -76,6 +79,7 @@ func (r *GamesRepo) GetGameByID(
&game.ID,
&game.Name,
&game.Description,
&game.Location,
&game.StartAt,
&game.Format,
&game.Status,
@@ -121,6 +125,7 @@ func (r *GamesRepo) GetGames(
games.id,
games.name,
games.description,
games.location,
games.start_at,
games.format,
games.status
@@ -139,6 +144,7 @@ func (r *GamesRepo) GetGames(
&game.ID,
&game.Name,
&game.Description,
&game.Location,
&game.StartAt,
&game.Format,
&game.Status,
@@ -160,6 +166,7 @@ func (r *GamesRepo) UpdateGame(
id int,
name string,
description string,
location *string,
startAt time.Time,
scenarioId int32,
format string,
@@ -170,13 +177,15 @@ func (r *GamesRepo) UpdateGame(
SET
name = $1,
description = $2,
start_at = $3,
scenario_id = $4,
format = $5,
location = $3,
start_at = $4,
scenario_id = $5,
format = $6,
updated_at = NOW()
WHERE id = $6`,
WHERE id = $7`,
name,
description,
location,
startAt,
scenarioId,
format,