generated from VLADIMIR/template
add location
This commit is contained in:
@@ -48,7 +48,7 @@ func TestServicesLifecyclePostgres(t *testing.T) {
|
||||
CREATE TEMP TABLE users(id INT, username TEXT);
|
||||
CREATE TEMP TABLE scenarios(id INT PRIMARY KEY, name TEXT, description TEXT, image TEXT, scenario TEXT,
|
||||
author_id INT, status TEXT DEFAULT 'draft', updated_at TIMESTAMP DEFAULT NOW(), created_at TIMESTAMP DEFAULT NOW(), published_at TIMESTAMP, is_deleted BOOLEAN DEFAULT FALSE);
|
||||
CREATE TEMP TABLE games(id SERIAL PRIMARY KEY, name TEXT, description TEXT, start_at TIMESTAMP, scenario_id INT,
|
||||
CREATE TEMP TABLE games(id SERIAL PRIMARY KEY, name TEXT, description TEXT, location TEXT, start_at TIMESTAMP, scenario_id INT,
|
||||
format TEXT, status TEXT DEFAULT 'draft', started_at TIMESTAMP, ended_at TIMESTAMP, updated_at TIMESTAMP DEFAULT NOW(), created_at TIMESTAMP DEFAULT NOW());
|
||||
CREATE TEMP TABLE teams(id SERIAL PRIMARY KEY, name TEXT, creator_id INT, game_id INT, password TEXT, status TEXT DEFAULT 'register', created_at TIMESTAMP DEFAULT NOW());
|
||||
CREATE TEMP TABLE actions(id SERIAL PRIMARY KEY, team_id INT, code TEXT, via_mcp BOOLEAN, created_at TIMESTAMP DEFAULT NOW());
|
||||
@@ -73,9 +73,9 @@ func TestServicesLifecyclePostgres(t *testing.T) {
|
||||
answers := answer_service.NewAnswerService(games, teams, scenarioService, team_answers_repo.NewTeamAnswersRepo(pool), actions)
|
||||
participation := participation_service.NewParticipationService(teams, "https://app.test")
|
||||
start := time.Now().Add(48 * time.Hour)
|
||||
id, err := game.AddGame(ctx, "Game", "", start, 1, "online")
|
||||
id, err := game.AddGame(ctx, "Game", "", nil, start, 1, "online")
|
||||
check(err)
|
||||
check(game.UpdateGame(ctx, id, "Game", "Updated", start, 1, ""))
|
||||
check(game.UpdateGame(ctx, id, "Game", "Updated", nil, start, 1, ""))
|
||||
registration := team_service.Registration{Name: "Team", Email: "captain@example.org", ParticipantsCount: 3}
|
||||
teamID, err := team.RegisterTeam(ctx, id, "delivery", registration)
|
||||
check(err)
|
||||
|
||||
@@ -47,6 +47,7 @@ func (s *GameService) AddGame(
|
||||
ctx context.Context,
|
||||
name string,
|
||||
description string,
|
||||
location *string,
|
||||
startAt time.Time,
|
||||
scenarioId int32,
|
||||
format string,
|
||||
@@ -57,7 +58,7 @@ func (s *GameService) AddGame(
|
||||
if format != "online" && format != "offline" {
|
||||
return 0, errors.New("Формат игры должен быть online или offline")
|
||||
}
|
||||
id, err := s.gamesRepo.AddGame(ctx, name, description, startAt, scenarioId, format)
|
||||
id, err := s.gamesRepo.AddGame(ctx, name, description, location, startAt, scenarioId, format)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -152,6 +153,7 @@ func (s *GameService) UpdateGame(
|
||||
id int,
|
||||
name string,
|
||||
description string,
|
||||
location *string,
|
||||
startAt time.Time,
|
||||
scenarioId int32,
|
||||
format string,
|
||||
@@ -166,7 +168,7 @@ func (s *GameService) UpdateGame(
|
||||
if format != "online" && format != "offline" {
|
||||
return errors.New("Формат игры должен быть online или offline")
|
||||
}
|
||||
return s.gamesRepo.UpdateGame(ctx, id, name, description, startAt, scenarioId, format)
|
||||
return s.gamesRepo.UpdateGame(ctx, id, name, description, location, startAt, scenarioId, format)
|
||||
}
|
||||
|
||||
func (s *GameService) StartGame(ctx context.Context, id int) error {
|
||||
|
||||
Reference in New Issue
Block a user