Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
-- name: CreateAPIKey :one
|
||||
INSERT INTO api_keys (company_id, user_id, name, key_hash, key_prefix)
|
||||
VALUES ($1, $2, $3, $4, $5)
|
||||
RETURNING *;
|
||||
|
||||
-- name: ListAPIKeysByCompany :many
|
||||
SELECT id, company_id, user_id, name, key_prefix, last_used_at, revoked_at, created_at, updated_at
|
||||
FROM api_keys
|
||||
WHERE company_id = $1 AND revoked_at IS NULL
|
||||
ORDER BY created_at DESC;
|
||||
|
||||
-- name: GetAPIKeyByHash :one
|
||||
SELECT * FROM api_keys
|
||||
WHERE key_hash = $1 AND revoked_at IS NULL
|
||||
LIMIT 1;
|
||||
|
||||
-- name: RevokeAPIKey :one
|
||||
UPDATE api_keys
|
||||
SET revoked_at = now(), updated_at = now()
|
||||
WHERE id = $1 AND company_id = $2
|
||||
RETURNING *;
|
||||
|
||||
-- name: TouchAPIKey :exec
|
||||
UPDATE api_keys SET last_used_at = now() WHERE id = $1;
|
||||
Reference in New Issue
Block a user