aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/database/query
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.com>2025-01-20 02:56:25 +0000
committerLeonardo Bishop <me@leonardobishop.com>2025-01-20 02:56:25 +0000
commitdc55f9c0097e1c36b85d7666071b840b902920e9 (patch)
treec8c8ae10a9e134810b3361aabc8a9d426d813808 /pkg/database/query
parent5e7ce6cbae81a1b6e46fe6738dc10039a06bec95 (diff)
Add calendar support
Diffstat (limited to 'pkg/database/query')
-rw-r--r--pkg/database/query/calendars.sql23
-rw-r--r--pkg/database/query/favourites.sql2
2 files changed, 24 insertions, 1 deletions
diff --git a/pkg/database/query/calendars.sql b/pkg/database/query/calendars.sql
new file mode 100644
index 0000000..490475d
--- /dev/null
+++ b/pkg/database/query/calendars.sql
@@ -0,0 +1,23 @@
+-- name: CreateCalendar :one
+INSERT INTO calendars (
+ user_id, name, key
+) VALUES (
+ $1, $2, $3
+)
+RETURNING *;
+
+-- name: GetCalendarForUser :one
+SELECT * FROM calendars
+WHERE user_id = $1 LIMIT 1;
+
+-- name: GetCalendarByName :one
+SELECT * FROM calendars
+WHERE name = $1 LIMIT 1;
+
+-- name: DeleteCalendar :execrows
+DELETE FROM calendars
+WHERE user_id = $1;
+
+-- name: DeleteCalendarByName :execrows
+DELETE FROM calendars
+WHERE name = $1;
diff --git a/pkg/database/query/favourites.sql b/pkg/database/query/favourites.sql
index 0661daa..94e914c 100644
--- a/pkg/database/query/favourites.sql
+++ b/pkg/database/query/favourites.sql
@@ -16,4 +16,4 @@ WHERE id = $1;
-- name: DeleteFavouriteByEventDetails :execrows
DELETE FROM favourites
-WHERE (event_guid = $1 OR event_id = $2) AND user_id = $3; \ No newline at end of file
+WHERE (event_guid = $1 OR event_id = $2) AND user_id = $3;