refactor(db): drop Querier and select only user id for session lookup

This commit is contained in:
kk10
2026-10-04 23:08:11 +03:00
parent 527c1748f8
commit 5d6f5a397f
4 changed files with 13 additions and 58 deletions
+4 -5
View File
@@ -9,11 +9,10 @@ INSERT INTO sessions (
sqlc.arg(expires_at)
);
-- name: GetSessionUser :one
SELECT u.id, u.username, u.display_name, u.created_at FROM sessions s
JOIN users u ON u.id = s.user_id
WHERE s.token_hash = sqlc.arg(token_hash)
AND s.expires_at > now();
-- name: GetSessionUserID :one
SELECT user_id FROM sessions
WHERE token_hash = sqlc.arg(token_hash)
AND expires_at > now();
-- name: DeleteSession :exec
DELETE FROM sessions