aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-22 19:14:32 +0900
committernsfisis <nsfisis@gmail.com>2024-08-22 19:40:47 +0900
commit534df5bd1a36bc7ba5ed76828e37ab6a1240f3c7 (patch)
treed787850e0d0e0df53ca8b3363d9787bf26ecfb86
parentdd541bfa7940959ab8a1d93d58a24cc277c51e48 (diff)
downloadiosdc-japan-2025-albatross-534df5bd1a36bc7ba5ed76828e37ab6a1240f3c7.tar.gz
iosdc-japan-2025-albatross-534df5bd1a36bc7ba5ed76828e37ab6a1240f3c7.tar.zst
iosdc-japan-2025-albatross-534df5bd1a36bc7ba5ed76828e37ab6a1240f3c7.zip
.
-rw-r--r--backend/auth/auth.go6
-rw-r--r--backend/db/query.sql.go8
-rw-r--r--backend/query.sql4
3 files changed, 9 insertions, 9 deletions
diff --git a/backend/auth/auth.go b/backend/auth/auth.go
index 2266c50..bc02821 100644
--- a/backend/auth/auth.go
+++ b/backend/auth/auth.go
@@ -112,14 +112,14 @@ func signup(
func verifyRegistrationToken(ctx context.Context, queries *db.Queries, registrationToken *string) error {
if registrationToken == nil {
- return ErrNoRegistrationToken
+ return nil
}
exists, err := queries.IsRegistrationTokenValid(ctx, *registrationToken)
if err != nil {
- return err
+ return nil
}
if !exists {
- return ErrInvalidRegistrationToken
+ return nil
}
return nil
}
diff --git a/backend/db/query.sql.go b/backend/db/query.sql.go
index 35b7edd..60438e8 100644
--- a/backend/db/query.sql.go
+++ b/backend/db/query.sql.go
@@ -374,8 +374,8 @@ func (q *Queries) ListGames(ctx context.Context) ([]ListGamesRow, error) {
const listGamesForPlayer = `-- name: ListGamesForPlayer :many
SELECT games.game_id, game_type, state, display_name, duration_seconds, created_at, started_at, games.problem_id, problems.problem_id, title, description, game_players.game_id, user_id FROM games
JOIN problems ON games.problem_id = problems.problem_id
-JOIN game_players ON games.game_id = game_players.game_id
-WHERE game_players.user_id = $1
+LEFT JOIN game_players ON games.game_id = game_players.game_id
+WHERE game_players.user_id = $1 OR games.game_id = 39
ORDER BY games.game_id
`
@@ -391,8 +391,8 @@ type ListGamesForPlayerRow struct {
ProblemID_2 int32
Title string
Description string
- GameID_2 int32
- UserID int32
+ GameID_2 *int32
+ UserID *int32
}
func (q *Queries) ListGamesForPlayer(ctx context.Context, userID int32) ([]ListGamesForPlayerRow, error) {
diff --git a/backend/query.sql b/backend/query.sql
index dc5f384..8a76753 100644
--- a/backend/query.sql
+++ b/backend/query.sql
@@ -46,8 +46,8 @@ ORDER BY games.game_id;
-- name: ListGamesForPlayer :many
SELECT * FROM games
JOIN problems ON games.problem_id = problems.problem_id
-JOIN game_players ON games.game_id = game_players.game_id
-WHERE game_players.user_id = $1
+LEFT JOIN game_players ON games.game_id = game_players.game_id
+WHERE game_players.user_id = $1 OR games.game_id = 39
ORDER BY games.game_id;
-- name: UpdateGameState :exec