mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
38 lines
448 B
SQL
38 lines
448 B
SQL
-- name: GetApiKey :one
|
|
select
|
|
*
|
|
from
|
|
apikeys
|
|
where
|
|
name = $1
|
|
and token = $2;
|
|
|
|
-- name: TouchApiKey :exec
|
|
update
|
|
apikeys
|
|
set
|
|
last_used = now()::timestamptz
|
|
where
|
|
pk = $1;
|
|
|
|
-- name: ListApiKeys :many
|
|
select
|
|
*
|
|
from
|
|
apikeys
|
|
order by
|
|
last_used;
|
|
|
|
-- name: CreateApiKey :one
|
|
insert into apikeys(name, token, claims, created_by)
|
|
values ($1, $2, $3, $4)
|
|
returning
|
|
*;
|
|
|
|
-- name: DeleteApiKey :one
|
|
delete from apikeys
|
|
where id = $1
|
|
returning
|
|
*;
|
|
|