generated from VLADIMIR/template
up
This commit is contained in:
@@ -119,7 +119,7 @@ func TestRegistrationPostgres(t *testing.T) {
|
||||
t.Fatalf("other game: %d %v", otherID, err)
|
||||
}
|
||||
for _, email := range []string{"", "manual@example.org"} {
|
||||
manualID, err := repo.AddTeamWithParticipation(ctx, 1, 2, "Manual", "password", email, false)
|
||||
manualID, err := repo.AddTeamWithParticipation(ctx, 1, 2, "Manual", "password", email, 0, false)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -121,11 +121,11 @@ func (r *TeamsRepo) AddTeam(
|
||||
name string,
|
||||
password string,
|
||||
) (int, error) {
|
||||
return r.AddTeamWithParticipation(ctx, creatorID, gameID, name, password, "", false)
|
||||
return r.AddTeamWithParticipation(ctx, creatorID, gameID, name, password, "", 0, false)
|
||||
}
|
||||
|
||||
// AddTeamWithParticipation creates a team with participation data.
|
||||
func (r *TeamsRepo) AddTeamWithParticipation(ctx context.Context, creatorID, gameID int, name, password, captainEmail string, autoConfirm bool) (int, error) {
|
||||
func (r *TeamsRepo) AddTeamWithParticipation(ctx context.Context, creatorID, gameID int, name, password, captainEmail string, participantsCount int32, autoConfirm bool) (int, error) {
|
||||
id := 0
|
||||
status, source := "pending", ""
|
||||
if autoConfirm {
|
||||
@@ -133,8 +133,8 @@ func (r *TeamsRepo) AddTeamWithParticipation(ctx context.Context, creatorID, gam
|
||||
}
|
||||
err := r.pool.QueryRow(
|
||||
ctx,
|
||||
`INSERT INTO teams (name, creator_id, game_id, password, participation_status, participation_source, participation_answered_at, captain_email)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, CASE WHEN $5 = 'confirmed' THEN NOW() ELSE NULL END, $7)
|
||||
`INSERT INTO teams (name, creator_id, game_id, password, participation_status, participation_source, participation_answered_at, captain_email, participants_count)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, CASE WHEN $5 = 'confirmed' THEN NOW() ELSE NULL END, $7, $8)
|
||||
RETURNING id`,
|
||||
name,
|
||||
creatorID,
|
||||
@@ -143,6 +143,7 @@ func (r *TeamsRepo) AddTeamWithParticipation(ctx context.Context, creatorID, gam
|
||||
status,
|
||||
source,
|
||||
captainEmail,
|
||||
participantsCount,
|
||||
).Scan(&id)
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user