aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-27 23:58:48 +0900
committernsfisis <nsfisis@gmail.com>2024-08-27 23:58:48 +0900
commit9543a2ec409b209eb2a415a68c5cd6b83ef43702 (patch)
tree252defebcd7651ca880cfc635c399b9f42d82148
parent534df5bd1a36bc7ba5ed76828e37ab6a1240f3c7 (diff)
downloadphperkaigi-2025-albatross-9543a2ec409b209eb2a415a68c5cd6b83ef43702.tar.gz
phperkaigi-2025-albatross-9543a2ec409b209eb2a415a68c5cd6b83ef43702.tar.zst
phperkaigi-2025-albatross-9543a2ec409b209eb2a415a68c5cd6b83ef43702.zip
Revert "."
This reverts commit 534df5bd1a36bc7ba5ed76828e37ab6a1240f3c7.
-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 bc02821..2266c50 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 nil
+ return ErrNoRegistrationToken
}
exists, err := queries.IsRegistrationTokenValid(ctx, *registrationToken)
if err != nil {
- return nil
+ return err
}
if !exists {
- return nil
+ return ErrInvalidRegistrationToken
}
return nil
}
diff --git a/backend/db/query.sql.go b/backend/db/query.sql.go
index 60438e8..35b7edd 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
-LEFT JOIN game_players ON games.game_id = game_players.game_id
-WHERE game_players.user_id = $1 OR games.game_id = 39
+JOIN game_players ON games.game_id = game_players.game_id
+WHERE game_players.user_id = $1
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 8a76753..dc5f384 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
-LEFT JOIN game_players ON games.game_id = game_players.game_id
-WHERE game_players.user_id = $1 OR games.game_id = 39
+JOIN game_players ON games.game_id = game_players.game_id
+WHERE game_players.user_id = $1
ORDER BY games.game_id;
-- name: UpdateGameState :exec