-- 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 id,client_id,name,redirect_uris,scopes,grant_types,created_at,updated_at,is_active; -- name: GetApiServiceCID :one SELECT id,client_id,name,redirect_uris,scopes,grant_types,created_at,updated_at,is_active FROM api_services WHERE client_id = $1 AND is_active = true LIMIT 1; -- name: ListApiServices :many SELECT id,client_id,name,redirect_uris,scopes,grant_types,created_at,updated_at,is_active 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 id,client_id,name,redirect_uris,scopes,grant_types,created_at,updated_at,is_active; -- 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;