From 39a926cd521806aedc298ddd671d1a118794fcec Mon Sep 17 00:00:00 2001
From: Leonardo Bishop <me@leonardobishop.net>
Date: Wed, 17 Sep 2025 18:13:30 +0100
Subject: Add endpoints for web extension

---
 pkg/database/query/entries.sql | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

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

diff --git a/pkg/database/query/entries.sql b/pkg/database/query/entries.sql
index 1f39016..9584adf 100644
--- a/pkg/database/query/entries.sql
+++ b/pkg/database/query/entries.sql
@@ -5,7 +5,27 @@ FROM kinds
 WHERE kinds.name = ?
 RETURNING *;
 
+-- name: UpdateEntryKind :one
+UPDATE entries
+SET kind = (SELECT id FROM kinds WHERE kinds.name = ?)
+WHERE entries.id = ? 
+RETURNING *;
+
+-- name: DeleteEntry :execrows
+DELETE FROM entries
+WHERE id = ?;
+
 -- name: GetEntries :many
 SELECT title, url, description, timestamp, kinds.name as kind_name, kinds.emoji as kind_emoji FROM entries
 JOIN kinds ON entries.kind == kinds.id
 ORDER BY timestamp DESC;
+
+-- name: GetEntryURLs :many
+SELECT url FROM entries
+ORDER BY timestamp DESC;
+
+-- name: GetEntryByUrl :one
+SELECT entries.id, title, url, description, timestamp, kinds.name as kind_name, kinds.emoji as kind_emoji FROM entries
+JOIN kinds ON entries.kind == kinds.id
+WHERE url = ?
+LIMIT 1;
-- 
cgit v1.2.3-70-g09d2

