-- name: ListIssues :many SELECT * FROM issue WHERE workspace_id = $1 ORDER BY position ASC, created_at DESC LIMIT $2 OFFSET $3; -- name: GetIssue :one SELECT * FROM issue WHERE id = $1; -- name: CreateIssue :one INSERT INTO issue ( workspace_id, title, description, status, priority, assignee_type, assignee_id, creator_type, creator_id, parent_issue_id, acceptance_criteria, context_refs, repository, position ) VALUES ( $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14 ) RETURNING *; -- name: UpdateIssue :one UPDATE issue SET title = COALESCE($2, title), description = COALESCE($3, description), status = COALESCE($4, status), priority = COALESCE($5, priority), assignee_type = $6, assignee_id = $7, position = COALESCE($8, position), updated_at = now() WHERE id = $1 RETURNING *; -- name: DeleteIssue :exec DELETE FROM issue WHERE id = $1;