Files
hatchet/internal/repository/prisma/dbsqlc/api_tokens.sql
Luca Steeb d1a4d35830 chore(pre-commit): lint whitespace (#494)
Adds a whitespace linter to the pre-commit hook to ensure consistent formatting.
It also enables linting of other SQL files such as for SQLc queries.
2024-05-16 09:17:01 -04:00

25 lines
438 B
SQL

-- name: GetAPITokenById :one
SELECT
*
FROM
"APIToken"
WHERE
"id" = @id::uuid;
-- name: CreateAPIToken :one
INSERT INTO "APIToken" (
"id",
"createdAt",
"updatedAt",
"tenantId",
"name",
"expiresAt"
) VALUES (
coalesce(@id::uuid, gen_random_uuid()),
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP,
sqlc.narg('tenantId')::uuid,
sqlc.narg('name')::text,
@expiresAt::timestamp
) RETURNING *;