2026-04-01 00:58:42 +08:00
|
|
|
-- name: ListTemplates :many
|
|
|
|
|
SELECT id, scope, tenant_id, origin_type, template_key, template_name,
|
2026-04-02 11:38:08 +08:00
|
|
|
prompt_template, prompt_visibility, card_config_json,
|
2026-04-01 00:58:42 +08:00
|
|
|
status, version_no, created_at, updated_at
|
|
|
|
|
FROM article_templates
|
|
|
|
|
WHERE (scope = 'platform' OR tenant_id = sqlc.arg(tenant_id)::bigint)
|
|
|
|
|
AND status = 'active' AND deleted_at IS NULL
|
|
|
|
|
ORDER BY created_at DESC;
|
|
|
|
|
|
|
|
|
|
-- name: GetTemplateByID :one
|
|
|
|
|
SELECT id, scope, tenant_id, origin_type, template_key, template_name,
|
2026-04-02 11:38:08 +08:00
|
|
|
prompt_template, prompt_visibility, protected_prompt_asset_key,
|
2026-04-01 00:58:42 +08:00
|
|
|
card_config_json, status, version_no, created_at, updated_at
|
|
|
|
|
FROM article_templates
|
|
|
|
|
WHERE id = sqlc.arg(id)
|
|
|
|
|
AND (scope = 'platform' OR tenant_id = sqlc.arg(tenant_id)::bigint)
|
|
|
|
|
AND deleted_at IS NULL;
|