feat: add CountPostsOfSite query and DB method

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Leon Mika 2026-03-22 14:30:57 +11:00
parent 9919f3444a
commit 5bf77ede5c
4 changed files with 82 additions and 0 deletions

View file

@ -1,3 +1,12 @@
-- name: CountPostsOfSite :one
SELECT COUNT(*) FROM posts
WHERE site_id = sqlc.arg(site_id) AND (
CASE CAST (sqlc.arg(post_filter) AS TEXT)
WHEN 'deleted' THEN deleted_at > 0
ELSE deleted_at = 0
END
);
-- name: SelectPostsOfSite :many
SELECT *
FROM posts