diff options
author | T <t@tjp.lol> | 2025-09-29 15:04:44 -0600 |
---|---|---|
committer | T <t@tjp.lol> | 2025-09-30 11:40:45 -0600 |
commit | 7ba68d333bc20b5795ccfd3870546a05eee60470 (patch) | |
tree | 12dc4b017803b7d01844fd42b9e3be281cbbd986 /internal/database/queries.sql | |
parent | bce8dbb58165e443902d9dae3909225ef42630c4 (diff) |
Diffstat (limited to 'internal/database/queries.sql')
-rw-r--r-- | internal/database/queries.sql | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/internal/database/queries.sql b/internal/database/queries.sql index 4ed5578..c3a356c 100644 --- a/internal/database/queries.sql +++ b/internal/database/queries.sql @@ -4,9 +4,9 @@ values (@name, @email, @billable_rate) returning *; -- name: FindClient :many -select c1.id, c1.name, c1.email, c1.billable_rate, c1.created_at from client c1 where c1.id = cast(@id as integer) +select c1.id, c1.name, c1.email, c1.billable_rate, c1.archived, c1.created_at from client c1 where c1.id = cast(@id as integer) union all -select c2.id, c2.name, c2.email, c2.billable_rate, c2.created_at from client c2 where c2.name = @name; +select c2.id, c2.name, c2.email, c2.billable_rate, c2.archived, c2.created_at from client c2 where c2.name = @name; -- name: CreateProject :one insert into project (name, client_id, billable_rate) @@ -14,9 +14,9 @@ values (@name, @client_id, @billable_rate) returning *; -- name: FindProject :many -select p1.id, p1.name, p1.client_id, p1.billable_rate, p1.created_at from project p1 where p1.id = cast(@id as integer) +select p1.id, p1.name, p1.client_id, p1.billable_rate, p1.archived, p1.created_at from project p1 where p1.id = cast(@id as integer) union all -select p2.id, p2.name, p2.client_id, p2.billable_rate, p2.created_at from project p2 where p2.name = @name; +select p2.id, p2.name, p2.client_id, p2.billable_rate, p2.archived, p2.created_at from project p2 where p2.name = @name; -- name: CreateTimeEntry :one insert into time_entry (start_time, description, client_id, project_id, billable_rate) @@ -327,3 +327,23 @@ where id = @entry_id; -- name: RemoveTimeEntry :exec delete from time_entry where id = @entry_id; + +-- name: ArchiveClient :exec +update client +set archived = 1 +where id = @id; + +-- name: UnarchiveClient :exec +update client +set archived = 0 +where id = @id; + +-- name: ArchiveProject :exec +update project +set archived = 1 +where id = @id; + +-- name: UnarchiveProject :exec +update project +set archived = 0 +where id = @id; |