taskcafe/internal/db/query/token.sql

15 lines
447 B
MySQL
Raw Normal View History

-- name: GetAuthTokenByID :one
SELECT * FROM auth_token WHERE token_id = $1;
2020-04-10 04:40:22 +02:00
-- name: CreateAuthToken :one
INSERT INTO auth_token (user_id, created_at, expires_at) VALUES ($1, $2, $3) RETURNING *;
2020-04-10 04:40:22 +02:00
-- name: DeleteAuthTokenByID :exec
DELETE FROM auth_token WHERE token_id = $1;
2020-04-10 04:40:22 +02:00
-- name: DeleteAuthTokenByUserID :exec
DELETE FROM auth_token WHERE user_id = $1;
2020-04-10 04:40:22 +02:00
-- name: DeleteExpiredTokens :exec
DELETE FROM auth_token WHERE expires_at <= NOW();