feat: Add GET previous template version endpoint (#5230)

This commit is contained in:
Bruno Quaresma
2022-12-06 11:15:03 -03:00
committed by GitHub
parent 84872d970d
commit e17fd0bb25
9 changed files with 212 additions and 5 deletions

View File

@ -110,3 +110,17 @@ SET
updated_at = $3
WHERE
job_id = $1;
-- name: GetPreviousTemplateVersion :one
SELECT
*
FROM
template_versions
WHERE
created_at < (
SELECT created_at
FROM template_versions AS tv
WHERE tv.organization_id = $1 AND tv.name = $2 AND tv.template_id = $3
)
ORDER BY created_at DESC
LIMIT 1;