taskcafe/internal/db/query/user_account.sql
Jordan Knott 64093e19f6 redesign
2022-05-06 16:44:31 -05:00

24 lines
755 B
SQL

-- name: GetUserAccounts :many
SELECT * FROM user_account;
-- name: GetUserAccountByUsername :one
SELECT * FROM user_account WHERE username = $1;
-- name: GetUserAccountByID :one
SELECT * FROM user_account WHERE user_id = $1;
-- name: HasAnyUserAccount :one
SELECT EXISTS (SELECT * FROM user_account LIMIT 1);
-- name: CreateUserAccount :one
INSERT INTO user_account (created_at, fullname, username, email, password_hash) VALUES ($1, $2, $3, $4, $5) RETURNING *;
-- name: CreateAccessToken :one
INSERT INTO access_token (token, user_id, expires_at, created_at) VALUES ($1, $2, $3, $4) RETURNING *;
-- name: GetAccessToken :one
SELECT * FROM access_token WHERE token = $1;
-- name: DeleteAccessToken :exec
DELETE FROM access_token WHERE token = $1;