diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-08-09 23:30:39 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-08-09 23:30:39 +0900 |
| commit | 41e98f3b0a936f7982434b74a88b919b99fd94ce (patch) | |
| tree | 72e1a3cc00044f9c00dc5f22ef9325124f272401 /backend/query.sql | |
| parent | 93f2ffc18d1d86bd2999533e8d904c92cb29bc1a (diff) | |
| parent | af36c59851399194bcbb77a3093d46c2757cb7b4 (diff) | |
| download | iosdc-japan-2024-albatross-41e98f3b0a936f7982434b74a88b919b99fd94ce.tar.gz iosdc-japan-2024-albatross-41e98f3b0a936f7982434b74a88b919b99fd94ce.tar.zst iosdc-japan-2024-albatross-41e98f3b0a936f7982434b74a88b919b99fd94ce.zip | |
Merge branch 'feat/auth-fortee'
Diffstat (limited to 'backend/query.sql')
| -rw-r--r-- | backend/query.sql | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/backend/query.sql b/backend/query.sql index f0e4034..13bbbe6 100644 --- a/backend/query.sql +++ b/backend/query.sql @@ -3,6 +3,11 @@ SELECT * FROM users WHERE users.user_id = $1 LIMIT 1; +-- name: CreateUser :one +INSERT INTO users (username, display_name, is_admin) +VALUES ($1, $1, false) +RETURNING user_id; + -- name: ListUsers :many SELECT * FROM users ORDER BY users.user_id; @@ -13,6 +18,16 @@ JOIN user_auths ON users.user_id = user_auths.user_id WHERE users.username = $1 LIMIT 1; +-- name: CreateUserAuth :exec +INSERT INTO user_auths (user_id, auth_type) +VALUES ($1, $2); + +-- name: IsRegistrationTokenValid :one +SELECT EXISTS ( + SELECT 1 FROM registration_tokens + WHERE token = $1 +); + -- name: ListGames :many SELECT * FROM games LEFT JOIN problems ON games.problem_id = problems.problem_id |
