feat: api_services queries
This commit is contained in:
39
queries/api_services.sql
Normal file
39
queries/api_services.sql
Normal file
@ -0,0 +1,39 @@
|
||||
-- name: CreateApiService :one
|
||||
INSERT INTO api_services (
|
||||
client_id, client_secret, name, redirect_uris, scopes, grant_types
|
||||
) VALUES (
|
||||
$1, $2, $3, $4, $5, $6
|
||||
) RETURNING *;
|
||||
|
||||
-- name: GetApiServiceCID :one
|
||||
SELECT * FROM api_services
|
||||
WHERE client_id = $1
|
||||
AND is_active = true
|
||||
LIMIT 1;
|
||||
|
||||
-- name: ListApiServices :many
|
||||
SELECT * FROM api_services
|
||||
ORDER BY created_at DESC;
|
||||
|
||||
-- name: UpdateApiService :one
|
||||
UPDATE api_services
|
||||
SET
|
||||
name = $2,
|
||||
redirect_uris = $3,
|
||||
scopes = $4,
|
||||
grant_types = $5,
|
||||
updated_at = NOW()
|
||||
WHERE client_id = $1
|
||||
RETURNING *;
|
||||
|
||||
-- name: DeactivateApiService :exec
|
||||
UPDATE api_services
|
||||
SET is_active = false,
|
||||
updated_at = NOW()
|
||||
WHERE client_id = $1;
|
||||
|
||||
-- name: UpdateClientSecret :exec
|
||||
UPDATE api_services
|
||||
SET client_secret = $2,
|
||||
updated_at = NOW()
|
||||
WHERE client_id = $1;
|
Reference in New Issue
Block a user