chore(db): retire the nine dead annotation plain queries + duplicate SQL line
H3 leftover: the annotation handlers route everything through the sync service (dedup/LWW/tombstones), leaving the plain Create/Update/Delete queries for media_notes/media_highlights/media_bookmarks with zero callers repo-wide (handlers, services, tests). Queries.sql drops them so H4's row work doesn't carry dead weight; sqlc regen compiles clean, proving nothing referenced the generated stubs. Also removes the literal duplicate `AND mi.missing_scan_count = 0` line in the library-stats query (harmless but confusing).
This commit is contained in:
1 parent
edb4e60679
commit
00305ffc7b
3 files changed
+4
-434
No files matched your search
@@ -920,54 +920,19 @@ ORDER BY score DESC, count DESC
|
||||
LIMIT sqlc.narg('limit') OFFSET sqlc.narg('offset');
|
||||
|
||||
-- Media Notes queries
|
||||
-- name: CreateMediaNote :one
|
||||
INSERT INTO media_notes (media_item_id, user_id, content, position)
|
||||
VALUES ($1, $2, $3, $4)
|
||||
RETURNING *;
|
||||
|
||||
-- name: GetMediaNote :one
|
||||
SELECT * FROM media_notes WHERE id = $1;
|
||||
|
||||
-- name: GetMediaNotes :many
|
||||
SELECT * FROM media_notes WHERE media_item_id = $1 AND user_id = $2 AND COALESCE(deleted, FALSE) = FALSE ORDER BY created_at DESC;
|
||||
|
||||
-- name: UpdateMediaNote :one
|
||||
UPDATE media_notes SET
|
||||
content = $2,
|
||||
position = $3,
|
||||
updated_at = NOW()
|
||||
WHERE id = $1 AND user_id = $4
|
||||
RETURNING *;
|
||||
|
||||
-- name: DeleteMediaNote :exec
|
||||
DELETE FROM media_notes WHERE id = $1 AND user_id = $2;
|
||||
|
||||
-- Media Highlights queries
|
||||
-- name: CreateMediaHighlight :one
|
||||
INSERT INTO media_highlights (media_item_id, user_id, selection_text, start_position, end_position, color, note_id)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7)
|
||||
RETURNING *;
|
||||
|
||||
-- name: GetMediaHighlight :one
|
||||
SELECT * FROM media_highlights WHERE id = $1;
|
||||
|
||||
-- name: GetMediaHighlights :many
|
||||
SELECT * FROM media_highlights WHERE media_item_id = $1 AND user_id = $2 AND COALESCE(deleted, FALSE) = FALSE ORDER BY created_at DESC;
|
||||
|
||||
-- name: UpdateMediaHighlight :one
|
||||
UPDATE media_highlights SET
|
||||
selection_text = $2,
|
||||
start_position = $3,
|
||||
end_position = $4,
|
||||
color = $5,
|
||||
note_id = $6,
|
||||
updated_at = NOW()
|
||||
WHERE id = $1 AND user_id = $7
|
||||
RETURNING *;
|
||||
|
||||
-- name: DeleteMediaHighlight :exec
|
||||
DELETE FROM media_highlights WHERE id = $1 AND user_id = $2;
|
||||
|
||||
-- ============================================
|
||||
-- ANNOTATION SYNC QUERIES (highlights)
|
||||
-- ============================================
|
||||
@@ -3038,25 +3003,6 @@ ORDER BY created_at DESC;
|
||||
-- name: GetMediaBookmark :one
|
||||
SELECT * FROM media_bookmarks WHERE id = $1;
|
||||
|
||||
-- name: CreateMediaBookmark :one
|
||||
INSERT INTO media_bookmarks (media_item_id, user_id, page_number, chapter_number, cfi_position, title, position, notes)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
||||
RETURNING *;
|
||||
|
||||
-- name: DeleteMediaBookmark :exec
|
||||
DELETE FROM media_bookmarks
|
||||
WHERE id = $1 AND user_id = $2;
|
||||
|
||||
-- name: UpdateMediaBookmark :one
|
||||
UPDATE media_bookmarks
|
||||
SET
|
||||
title = $2,
|
||||
notes = $3,
|
||||
position = $4,
|
||||
last_modified_at = NOW()
|
||||
WHERE id = $1 AND user_id = $5
|
||||
RETURNING *;
|
||||
|
||||
-- ============================================================================
|
||||
-- PROCESSING ISSUES QUERIES
|
||||
-- ============================================================================
|
||||
|
||||
Reference in new issue
Block a user