From 665bd389a0a1c8adadcaa1122e846cc81f5ead31 Mon Sep 17 00:00:00 2001
From: T <t@tjp.lol>
Date: Tue, 5 Aug 2025 11:37:02 -0600
Subject: WIP TUI

---
 internal/database/queries.sql | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

(limited to 'internal/database/queries.sql')

diff --git a/internal/database/queries.sql b/internal/database/queries.sql
index 3a644b8..c68cdad 100644
--- a/internal/database/queries.sql
+++ b/internal/database/queries.sql
@@ -284,3 +284,32 @@ where p.id = @project_id
     and te.start_time <= @end_time
     and te.end_time is not null
 order by te.start_time;
+
+-- name: GetTodaySummary :one
+select 
+    cast(sum(
+        case 
+            when te.end_time is null then 
+                (julianday('now', 'utc') - julianday(te.start_time)) * 24 * 60 * 60
+            else 
+                (julianday(te.end_time) - julianday(te.start_time)) * 24 * 60 * 60
+        end
+    ) as integer) as total_seconds
+from time_entry te
+where date(te.start_time) = date('now');
+
+-- name: GetRecentTimeEntries :many
+select * from time_entry 
+order by start_time desc
+limit @limit_count;
+
+-- name: UpdateActiveTimerDescription :exec
+update time_entry 
+set description = @description
+where id = (
+	select id
+	from time_entry
+	where end_time is null
+	order by start_time desc
+	limit 1
+);
-- 
cgit v1.2.3

