From c00b690bd6f600554a1404e692bd9e4373325d27 Mon Sep 17 00:00:00 2001
From: Leonardo Bishop <me@leonardobishop.com>
Date: Fri, 17 Jan 2025 13:21:24 +0000
Subject: Initial commit

---
 pkg/database/query/favourites.sql | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 pkg/database/query/favourites.sql

(limited to 'pkg/database/query/favourites.sql')

diff --git a/pkg/database/query/favourites.sql b/pkg/database/query/favourites.sql
new file mode 100644
index 0000000..0661daa
--- /dev/null
+++ b/pkg/database/query/favourites.sql
@@ -0,0 +1,19 @@
+-- name: GetFavouritesForUser :many
+SELECT * FROM favourites
+WHERE user_id = $1;
+
+-- name: CreateFavourite :one
+INSERT INTO favourites (
+  user_id, event_guid, event_id
+) VALUES (
+  $1, $2, $3
+)
+RETURNING *;
+
+-- name: DeleteFavourite :exec
+DELETE FROM favourites
+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
-- 
cgit v1.2.3-70-g09d2

