Initial commit

This commit is contained in:
2026-09-22 22:51:19 +08:00
commit 967dcecb7e
80 changed files with 10762 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
-- name: ListProjects :many
SELECT * FROM projects
ORDER BY sort ASC, created_at ASC;
-- name: ListActiveProjects :many
SELECT * FROM projects
WHERE status = 'active'
ORDER BY sort ASC, created_at ASC;
-- name: ListActiveProjectsByCategory :many
SELECT * FROM projects
WHERE category_id = ? AND status = 'active'
ORDER BY sort ASC, created_at ASC;
-- name: CountProjectsByCategory :one
SELECT COUNT(*) FROM projects
WHERE category_id = ?;
-- name: GetProject :one
SELECT * FROM projects
WHERE id = ?;
-- name: CreateProject :one
INSERT INTO projects (
id, category_id, name, subtitle, price_text, image, status, sort
)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
RETURNING *;
-- name: UpdateProject :one
UPDATE projects
SET category_id = ?,
name = ?,
subtitle = ?,
price_text = ?,
image = ?,
status = ?,
sort = ?,
updated_at = CURRENT_TIMESTAMP
WHERE id = ?
RETURNING *;
-- name: DeleteProject :exec
DELETE FROM projects
WHERE id = ?;