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
@@ -74,10 +74,7 @@ type Querier interface {
|
|||||||
CreateHashConflict(ctx context.Context, arg CreateHashConflictParams) error
|
CreateHashConflict(ctx context.Context, arg CreateHashConflictParams) error
|
||||||
// Libraries queries
|
// Libraries queries
|
||||||
CreateLibrary(ctx context.Context, arg CreateLibraryParams) (Libraries, error)
|
CreateLibrary(ctx context.Context, arg CreateLibraryParams) (Libraries, error)
|
||||||
CreateMediaBookmark(ctx context.Context, arg CreateMediaBookmarkParams) (MediaBookmarks, error)
|
|
||||||
CreateMediaBookmarkFull(ctx context.Context, arg CreateMediaBookmarkFullParams) (MediaBookmarks, error)
|
CreateMediaBookmarkFull(ctx context.Context, arg CreateMediaBookmarkFullParams) (MediaBookmarks, error)
|
||||||
// Media Highlights queries
|
|
||||||
CreateMediaHighlight(ctx context.Context, arg CreateMediaHighlightParams) (MediaHighlights, error)
|
|
||||||
CreateMediaHighlightFull(ctx context.Context, arg CreateMediaHighlightFullParams) (MediaHighlights, error)
|
CreateMediaHighlightFull(ctx context.Context, arg CreateMediaHighlightFullParams) (MediaHighlights, error)
|
||||||
// Media Items queries
|
// Media Items queries
|
||||||
// narrators/narrators_search are NOT NULL DEFAULT '{}' (A2): callers MUST
|
// narrators/narrators_search are NOT NULL DEFAULT '{}' (A2): callers MUST
|
||||||
@@ -94,8 +91,6 @@ type Querier interface {
|
|||||||
// narrators NOT NULL: callers pass empty slices, never nil (see
|
// narrators NOT NULL: callers pass empty slices, never nil (see
|
||||||
// CreateMediaItem note).
|
// CreateMediaItem note).
|
||||||
CreateMediaItemIfNew(ctx context.Context, arg CreateMediaItemIfNewParams) (MediaItems, error)
|
CreateMediaItemIfNew(ctx context.Context, arg CreateMediaItemIfNewParams) (MediaItems, error)
|
||||||
// Media Notes queries
|
|
||||||
CreateMediaNote(ctx context.Context, arg CreateMediaNoteParams) (MediaNotes, error)
|
|
||||||
CreateMediaNoteFull(ctx context.Context, arg CreateMediaNoteFullParams) (MediaNotes, error)
|
CreateMediaNoteFull(ctx context.Context, arg CreateMediaNoteFullParams) (MediaNotes, error)
|
||||||
CreateMediaRating(ctx context.Context, arg CreateMediaRatingParams) (MediaRatings, error)
|
CreateMediaRating(ctx context.Context, arg CreateMediaRatingParams) (MediaRatings, error)
|
||||||
// OPDS TOKENS QUERIES
|
// OPDS TOKENS QUERIES
|
||||||
@@ -140,12 +135,9 @@ type Querier interface {
|
|||||||
DeleteKoboEntitlement(ctx context.Context, arg DeleteKoboEntitlementParams) error
|
DeleteKoboEntitlement(ctx context.Context, arg DeleteKoboEntitlementParams) error
|
||||||
DeleteLibrary(ctx context.Context, id pgtype.UUID) error
|
DeleteLibrary(ctx context.Context, id pgtype.UUID) error
|
||||||
DeleteLibraryFolder(ctx context.Context, arg DeleteLibraryFolderParams) (LibraryFolders, error)
|
DeleteLibraryFolder(ctx context.Context, arg DeleteLibraryFolderParams) (LibraryFolders, error)
|
||||||
DeleteMediaBookmark(ctx context.Context, arg DeleteMediaBookmarkParams) error
|
|
||||||
DeleteMediaHighlight(ctx context.Context, arg DeleteMediaHighlightParams) error
|
|
||||||
DeleteMediaItem(ctx context.Context, id pgtype.UUID) error
|
DeleteMediaItem(ctx context.Context, id pgtype.UUID) error
|
||||||
// Delete media item format
|
// Delete media item format
|
||||||
DeleteMediaItemFormat(ctx context.Context, id pgtype.UUID) error
|
DeleteMediaItemFormat(ctx context.Context, id pgtype.UUID) error
|
||||||
DeleteMediaNote(ctx context.Context, arg DeleteMediaNoteParams) error
|
|
||||||
DeleteMediaRating(ctx context.Context, arg DeleteMediaRatingParams) error
|
DeleteMediaRating(ctx context.Context, arg DeleteMediaRatingParams) error
|
||||||
DeleteMediaReview(ctx context.Context, arg DeleteMediaReviewParams) error
|
DeleteMediaReview(ctx context.Context, arg DeleteMediaReviewParams) error
|
||||||
DeleteProcessingIssue(ctx context.Context, id pgtype.UUID) (ProcessingIssues, error)
|
DeleteProcessingIssue(ctx context.Context, id pgtype.UUID) (ProcessingIssues, error)
|
||||||
@@ -284,6 +276,7 @@ type Querier interface {
|
|||||||
// ============================================
|
// ============================================
|
||||||
GetMediaBookmarkByDedupKey(ctx context.Context, arg GetMediaBookmarkByDedupKeyParams) (MediaBookmarks, error)
|
GetMediaBookmarkByDedupKey(ctx context.Context, arg GetMediaBookmarkByDedupKeyParams) (MediaBookmarks, error)
|
||||||
GetMediaBookmarks(ctx context.Context, arg GetMediaBookmarksParams) ([]MediaBookmarks, error)
|
GetMediaBookmarks(ctx context.Context, arg GetMediaBookmarksParams) ([]MediaBookmarks, error)
|
||||||
|
// Media Highlights queries
|
||||||
GetMediaHighlight(ctx context.Context, id pgtype.UUID) (MediaHighlights, error)
|
GetMediaHighlight(ctx context.Context, id pgtype.UUID) (MediaHighlights, error)
|
||||||
// ============================================
|
// ============================================
|
||||||
// ANNOTATION SYNC QUERIES (highlights)
|
// ANNOTATION SYNC QUERIES (highlights)
|
||||||
@@ -321,6 +314,7 @@ type Querier interface {
|
|||||||
// hidden/archived rows whose file vanished (move candidates - the scanner
|
// hidden/archived rows whose file vanished (move candidates - the scanner
|
||||||
// verifies disk state before repointing).
|
// verifies disk state before repointing).
|
||||||
GetMediaItemsBySHA256AndSameLibraryType(ctx context.Context, arg GetMediaItemsBySHA256AndSameLibraryTypeParams) ([]GetMediaItemsBySHA256AndSameLibraryTypeRow, error)
|
GetMediaItemsBySHA256AndSameLibraryType(ctx context.Context, arg GetMediaItemsBySHA256AndSameLibraryTypeParams) ([]GetMediaItemsBySHA256AndSameLibraryTypeRow, error)
|
||||||
|
// Media Notes queries
|
||||||
GetMediaNote(ctx context.Context, id pgtype.UUID) (MediaNotes, error)
|
GetMediaNote(ctx context.Context, id pgtype.UUID) (MediaNotes, error)
|
||||||
// ============================================
|
// ============================================
|
||||||
// ANNOTATION SYNC QUERIES (notes)
|
// ANNOTATION SYNC QUERIES (notes)
|
||||||
@@ -569,9 +563,7 @@ type Querier interface {
|
|||||||
// Update Kobo shelves to support collections
|
// Update Kobo shelves to support collections
|
||||||
UpdateKoboShelfCollection(ctx context.Context, arg UpdateKoboShelfCollectionParams) (KoboShelves, error)
|
UpdateKoboShelfCollection(ctx context.Context, arg UpdateKoboShelfCollectionParams) (KoboShelves, error)
|
||||||
UpdateLibrary(ctx context.Context, arg UpdateLibraryParams) (Libraries, error)
|
UpdateLibrary(ctx context.Context, arg UpdateLibraryParams) (Libraries, error)
|
||||||
UpdateMediaBookmark(ctx context.Context, arg UpdateMediaBookmarkParams) (MediaBookmarks, error)
|
|
||||||
UpdateMediaBookmarkForSync(ctx context.Context, arg UpdateMediaBookmarkForSyncParams) (MediaBookmarks, error)
|
UpdateMediaBookmarkForSync(ctx context.Context, arg UpdateMediaBookmarkForSyncParams) (MediaBookmarks, error)
|
||||||
UpdateMediaHighlight(ctx context.Context, arg UpdateMediaHighlightParams) (MediaHighlights, error)
|
|
||||||
UpdateMediaHighlightForSync(ctx context.Context, arg UpdateMediaHighlightForSyncParams) (MediaHighlights, error)
|
UpdateMediaHighlightForSync(ctx context.Context, arg UpdateMediaHighlightForSyncParams) (MediaHighlights, error)
|
||||||
UpdateMediaItem(ctx context.Context, arg UpdateMediaItemParams) (MediaItems, error)
|
UpdateMediaItem(ctx context.Context, arg UpdateMediaItemParams) (MediaItems, error)
|
||||||
UpdateMediaItemChapterMetadata(ctx context.Context, arg UpdateMediaItemChapterMetadataParams) (MediaItems, error)
|
UpdateMediaItemChapterMetadata(ctx context.Context, arg UpdateMediaItemChapterMetadataParams) (MediaItems, error)
|
||||||
@@ -589,7 +581,6 @@ type Querier interface {
|
|||||||
// Update media item with universal identifiers
|
// Update media item with universal identifiers
|
||||||
UpdateMediaItemIdentifiers(ctx context.Context, arg UpdateMediaItemIdentifiersParams) (MediaItems, error)
|
UpdateMediaItemIdentifiers(ctx context.Context, arg UpdateMediaItemIdentifiersParams) (MediaItems, error)
|
||||||
UpdateMediaItemKoboMetadata(ctx context.Context, arg UpdateMediaItemKoboMetadataParams) (MediaItems, error)
|
UpdateMediaItemKoboMetadata(ctx context.Context, arg UpdateMediaItemKoboMetadataParams) (MediaItems, error)
|
||||||
UpdateMediaNote(ctx context.Context, arg UpdateMediaNoteParams) (MediaNotes, error)
|
|
||||||
UpdateMediaNoteForSync(ctx context.Context, arg UpdateMediaNoteForSyncParams) (MediaNotes, error)
|
UpdateMediaNoteForSync(ctx context.Context, arg UpdateMediaNoteForSyncParams) (MediaNotes, error)
|
||||||
UpdateMediaRating(ctx context.Context, arg UpdateMediaRatingParams) (MediaRatings, error)
|
UpdateMediaRating(ctx context.Context, arg UpdateMediaRatingParams) (MediaRatings, error)
|
||||||
UpdatePassword(ctx context.Context, arg UpdatePasswordParams) error
|
UpdatePassword(ctx context.Context, arg UpdatePasswordParams) error
|
||||||
|
|||||||
@@ -703,60 +703,6 @@ func (q *Queries) CreateLibrary(ctx context.Context, arg CreateLibraryParams) (L
|
|||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
|
|
||||||
const CreateMediaBookmark = `-- 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 id, media_item_id, user_id, page_number, chapter_number, cfi_position, title, position, notes, created_at, dedup_key, last_modified_at, last_modified_source, device_sync_data, percentage_location, epubcfi_location, chapter_reference, deleted, deleted_at, origin_source
|
|
||||||
`
|
|
||||||
|
|
||||||
type CreateMediaBookmarkParams struct {
|
|
||||||
MediaItemID pgtype.UUID `db:"media_item_id" json:"media_item_id"`
|
|
||||||
UserID pgtype.UUID `db:"user_id" json:"user_id"`
|
|
||||||
PageNumber pgtype.Int4 `db:"page_number" json:"page_number"`
|
|
||||||
ChapterNumber pgtype.Int4 `db:"chapter_number" json:"chapter_number"`
|
|
||||||
CfiPosition pgtype.Text `db:"cfi_position" json:"cfi_position"`
|
|
||||||
Title string `db:"title" json:"title"`
|
|
||||||
Position pgtype.Text `db:"position" json:"position"`
|
|
||||||
Notes pgtype.Text `db:"notes" json:"notes"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (q *Queries) CreateMediaBookmark(ctx context.Context, arg CreateMediaBookmarkParams) (MediaBookmarks, error) {
|
|
||||||
row := q.db.QueryRow(ctx, CreateMediaBookmark,
|
|
||||||
arg.MediaItemID,
|
|
||||||
arg.UserID,
|
|
||||||
arg.PageNumber,
|
|
||||||
arg.ChapterNumber,
|
|
||||||
arg.CfiPosition,
|
|
||||||
arg.Title,
|
|
||||||
arg.Position,
|
|
||||||
arg.Notes,
|
|
||||||
)
|
|
||||||
var i MediaBookmarks
|
|
||||||
err := row.Scan(
|
|
||||||
&i.ID,
|
|
||||||
&i.MediaItemID,
|
|
||||||
&i.UserID,
|
|
||||||
&i.PageNumber,
|
|
||||||
&i.ChapterNumber,
|
|
||||||
&i.CfiPosition,
|
|
||||||
&i.Title,
|
|
||||||
&i.Position,
|
|
||||||
&i.Notes,
|
|
||||||
&i.CreatedAt,
|
|
||||||
&i.DedupKey,
|
|
||||||
&i.LastModifiedAt,
|
|
||||||
&i.LastModifiedSource,
|
|
||||||
&i.DeviceSyncData,
|
|
||||||
&i.PercentageLocation,
|
|
||||||
&i.EpubcfiLocation,
|
|
||||||
&i.ChapterReference,
|
|
||||||
&i.Deleted,
|
|
||||||
&i.DeletedAt,
|
|
||||||
&i.OriginSource,
|
|
||||||
)
|
|
||||||
return i, err
|
|
||||||
}
|
|
||||||
|
|
||||||
const CreateMediaBookmarkFull = `-- name: CreateMediaBookmarkFull :one
|
const CreateMediaBookmarkFull = `-- name: CreateMediaBookmarkFull :one
|
||||||
INSERT INTO media_bookmarks (
|
INSERT INTO media_bookmarks (
|
||||||
media_item_id, user_id, page_number, chapter_number,
|
media_item_id, user_id, page_number, chapter_number,
|
||||||
@@ -833,66 +779,6 @@ func (q *Queries) CreateMediaBookmarkFull(ctx context.Context, arg CreateMediaBo
|
|||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
|
|
||||||
const CreateMediaHighlight = `-- 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 id, media_item_id, user_id, selection_text, start_position, end_position, color, note_id, created_at, updated_at, percentage_start, percentage_end, character_start, character_end, epubcfi_start, epubcfi_end, chapter_reference, paragraph_start, paragraph_end, panel_number, device_sync_data, dedup_key, last_modified_at, last_modified_source, note_text, deleted, deleted_at
|
|
||||||
`
|
|
||||||
|
|
||||||
type CreateMediaHighlightParams struct {
|
|
||||||
MediaItemID pgtype.UUID `db:"media_item_id" json:"media_item_id"`
|
|
||||||
UserID pgtype.UUID `db:"user_id" json:"user_id"`
|
|
||||||
SelectionText string `db:"selection_text" json:"selection_text"`
|
|
||||||
StartPosition pgtype.Text `db:"start_position" json:"start_position"`
|
|
||||||
EndPosition pgtype.Text `db:"end_position" json:"end_position"`
|
|
||||||
Color pgtype.Text `db:"color" json:"color"`
|
|
||||||
NoteID pgtype.UUID `db:"note_id" json:"note_id"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Media Highlights queries
|
|
||||||
func (q *Queries) CreateMediaHighlight(ctx context.Context, arg CreateMediaHighlightParams) (MediaHighlights, error) {
|
|
||||||
row := q.db.QueryRow(ctx, CreateMediaHighlight,
|
|
||||||
arg.MediaItemID,
|
|
||||||
arg.UserID,
|
|
||||||
arg.SelectionText,
|
|
||||||
arg.StartPosition,
|
|
||||||
arg.EndPosition,
|
|
||||||
arg.Color,
|
|
||||||
arg.NoteID,
|
|
||||||
)
|
|
||||||
var i MediaHighlights
|
|
||||||
err := row.Scan(
|
|
||||||
&i.ID,
|
|
||||||
&i.MediaItemID,
|
|
||||||
&i.UserID,
|
|
||||||
&i.SelectionText,
|
|
||||||
&i.StartPosition,
|
|
||||||
&i.EndPosition,
|
|
||||||
&i.Color,
|
|
||||||
&i.NoteID,
|
|
||||||
&i.CreatedAt,
|
|
||||||
&i.UpdatedAt,
|
|
||||||
&i.PercentageStart,
|
|
||||||
&i.PercentageEnd,
|
|
||||||
&i.CharacterStart,
|
|
||||||
&i.CharacterEnd,
|
|
||||||
&i.EpubcfiStart,
|
|
||||||
&i.EpubcfiEnd,
|
|
||||||
&i.ChapterReference,
|
|
||||||
&i.ParagraphStart,
|
|
||||||
&i.ParagraphEnd,
|
|
||||||
&i.PanelNumber,
|
|
||||||
&i.DeviceSyncData,
|
|
||||||
&i.DedupKey,
|
|
||||||
&i.LastModifiedAt,
|
|
||||||
&i.LastModifiedSource,
|
|
||||||
&i.NoteText,
|
|
||||||
&i.Deleted,
|
|
||||||
&i.DeletedAt,
|
|
||||||
)
|
|
||||||
return i, err
|
|
||||||
}
|
|
||||||
|
|
||||||
const CreateMediaHighlightFull = `-- name: CreateMediaHighlightFull :one
|
const CreateMediaHighlightFull = `-- name: CreateMediaHighlightFull :one
|
||||||
INSERT INTO media_highlights (
|
INSERT INTO media_highlights (
|
||||||
media_item_id, user_id, selection_text,
|
media_item_id, user_id, selection_text,
|
||||||
@@ -1403,52 +1289,6 @@ func (q *Queries) CreateMediaItemIfNew(ctx context.Context, arg CreateMediaItemI
|
|||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
|
|
||||||
const CreateMediaNote = `-- name: CreateMediaNote :one
|
|
||||||
INSERT INTO media_notes (media_item_id, user_id, content, position)
|
|
||||||
VALUES ($1, $2, $3, $4)
|
|
||||||
RETURNING id, media_item_id, user_id, content, position, created_at, updated_at, percentage_location, character_start, character_end, epubcfi_location, chapter_reference, paragraph_reference, device_sync_data, dedup_key, last_modified_at, last_modified_source, deleted, deleted_at
|
|
||||||
`
|
|
||||||
|
|
||||||
type CreateMediaNoteParams struct {
|
|
||||||
MediaItemID pgtype.UUID `db:"media_item_id" json:"media_item_id"`
|
|
||||||
UserID pgtype.UUID `db:"user_id" json:"user_id"`
|
|
||||||
Content string `db:"content" json:"content"`
|
|
||||||
Position pgtype.Text `db:"position" json:"position"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Media Notes queries
|
|
||||||
func (q *Queries) CreateMediaNote(ctx context.Context, arg CreateMediaNoteParams) (MediaNotes, error) {
|
|
||||||
row := q.db.QueryRow(ctx, CreateMediaNote,
|
|
||||||
arg.MediaItemID,
|
|
||||||
arg.UserID,
|
|
||||||
arg.Content,
|
|
||||||
arg.Position,
|
|
||||||
)
|
|
||||||
var i MediaNotes
|
|
||||||
err := row.Scan(
|
|
||||||
&i.ID,
|
|
||||||
&i.MediaItemID,
|
|
||||||
&i.UserID,
|
|
||||||
&i.Content,
|
|
||||||
&i.Position,
|
|
||||||
&i.CreatedAt,
|
|
||||||
&i.UpdatedAt,
|
|
||||||
&i.PercentageLocation,
|
|
||||||
&i.CharacterStart,
|
|
||||||
&i.CharacterEnd,
|
|
||||||
&i.EpubcfiLocation,
|
|
||||||
&i.ChapterReference,
|
|
||||||
&i.ParagraphReference,
|
|
||||||
&i.DeviceSyncData,
|
|
||||||
&i.DedupKey,
|
|
||||||
&i.LastModifiedAt,
|
|
||||||
&i.LastModifiedSource,
|
|
||||||
&i.Deleted,
|
|
||||||
&i.DeletedAt,
|
|
||||||
)
|
|
||||||
return i, err
|
|
||||||
}
|
|
||||||
|
|
||||||
const CreateMediaNoteFull = `-- name: CreateMediaNoteFull :one
|
const CreateMediaNoteFull = `-- name: CreateMediaNoteFull :one
|
||||||
INSERT INTO media_notes (
|
INSERT INTO media_notes (
|
||||||
media_item_id, user_id, content, position,
|
media_item_id, user_id, content, position,
|
||||||
@@ -2215,35 +2055,6 @@ func (q *Queries) DeleteLibraryFolder(ctx context.Context, arg DeleteLibraryFold
|
|||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
|
|
||||||
const DeleteMediaBookmark = `-- name: DeleteMediaBookmark :exec
|
|
||||||
DELETE FROM media_bookmarks
|
|
||||||
WHERE id = $1 AND user_id = $2
|
|
||||||
`
|
|
||||||
|
|
||||||
type DeleteMediaBookmarkParams struct {
|
|
||||||
ID pgtype.UUID `db:"id" json:"id"`
|
|
||||||
UserID pgtype.UUID `db:"user_id" json:"user_id"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (q *Queries) DeleteMediaBookmark(ctx context.Context, arg DeleteMediaBookmarkParams) error {
|
|
||||||
_, err := q.db.Exec(ctx, DeleteMediaBookmark, arg.ID, arg.UserID)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
const DeleteMediaHighlight = `-- name: DeleteMediaHighlight :exec
|
|
||||||
DELETE FROM media_highlights WHERE id = $1 AND user_id = $2
|
|
||||||
`
|
|
||||||
|
|
||||||
type DeleteMediaHighlightParams struct {
|
|
||||||
ID pgtype.UUID `db:"id" json:"id"`
|
|
||||||
UserID pgtype.UUID `db:"user_id" json:"user_id"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (q *Queries) DeleteMediaHighlight(ctx context.Context, arg DeleteMediaHighlightParams) error {
|
|
||||||
_, err := q.db.Exec(ctx, DeleteMediaHighlight, arg.ID, arg.UserID)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
const DeleteMediaItem = `-- name: DeleteMediaItem :exec
|
const DeleteMediaItem = `-- name: DeleteMediaItem :exec
|
||||||
DELETE FROM media_items WHERE id = $1
|
DELETE FROM media_items WHERE id = $1
|
||||||
`
|
`
|
||||||
@@ -2263,20 +2074,6 @@ func (q *Queries) DeleteMediaItemFormat(ctx context.Context, id pgtype.UUID) err
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
const DeleteMediaNote = `-- name: DeleteMediaNote :exec
|
|
||||||
DELETE FROM media_notes WHERE id = $1 AND user_id = $2
|
|
||||||
`
|
|
||||||
|
|
||||||
type DeleteMediaNoteParams struct {
|
|
||||||
ID pgtype.UUID `db:"id" json:"id"`
|
|
||||||
UserID pgtype.UUID `db:"user_id" json:"user_id"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (q *Queries) DeleteMediaNote(ctx context.Context, arg DeleteMediaNoteParams) error {
|
|
||||||
_, err := q.db.Exec(ctx, DeleteMediaNote, arg.ID, arg.UserID)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
const DeleteMediaRating = `-- name: DeleteMediaRating :exec
|
const DeleteMediaRating = `-- name: DeleteMediaRating :exec
|
||||||
DELETE FROM media_ratings WHERE media_item_id = $1 AND user_id = $2
|
DELETE FROM media_ratings WHERE media_item_id = $1 AND user_id = $2
|
||||||
`
|
`
|
||||||
@@ -5488,6 +5285,7 @@ const GetMediaHighlight = `-- name: GetMediaHighlight :one
|
|||||||
SELECT id, media_item_id, user_id, selection_text, start_position, end_position, color, note_id, created_at, updated_at, percentage_start, percentage_end, character_start, character_end, epubcfi_start, epubcfi_end, chapter_reference, paragraph_start, paragraph_end, panel_number, device_sync_data, dedup_key, last_modified_at, last_modified_source, note_text, deleted, deleted_at FROM media_highlights WHERE id = $1
|
SELECT id, media_item_id, user_id, selection_text, start_position, end_position, color, note_id, created_at, updated_at, percentage_start, percentage_end, character_start, character_end, epubcfi_start, epubcfi_end, chapter_reference, paragraph_start, paragraph_end, panel_number, device_sync_data, dedup_key, last_modified_at, last_modified_source, note_text, deleted, deleted_at FROM media_highlights WHERE id = $1
|
||||||
`
|
`
|
||||||
|
|
||||||
|
// Media Highlights queries
|
||||||
func (q *Queries) GetMediaHighlight(ctx context.Context, id pgtype.UUID) (MediaHighlights, error) {
|
func (q *Queries) GetMediaHighlight(ctx context.Context, id pgtype.UUID) (MediaHighlights, error) {
|
||||||
row := q.db.QueryRow(ctx, GetMediaHighlight, id)
|
row := q.db.QueryRow(ctx, GetMediaHighlight, id)
|
||||||
var i MediaHighlights
|
var i MediaHighlights
|
||||||
@@ -6760,6 +6558,7 @@ const GetMediaNote = `-- name: GetMediaNote :one
|
|||||||
SELECT id, media_item_id, user_id, content, position, created_at, updated_at, percentage_location, character_start, character_end, epubcfi_location, chapter_reference, paragraph_reference, device_sync_data, dedup_key, last_modified_at, last_modified_source, deleted, deleted_at FROM media_notes WHERE id = $1
|
SELECT id, media_item_id, user_id, content, position, created_at, updated_at, percentage_location, character_start, character_end, epubcfi_location, chapter_reference, paragraph_reference, device_sync_data, dedup_key, last_modified_at, last_modified_source, deleted, deleted_at FROM media_notes WHERE id = $1
|
||||||
`
|
`
|
||||||
|
|
||||||
|
// Media Notes queries
|
||||||
func (q *Queries) GetMediaNote(ctx context.Context, id pgtype.UUID) (MediaNotes, error) {
|
func (q *Queries) GetMediaNote(ctx context.Context, id pgtype.UUID) (MediaNotes, error) {
|
||||||
row := q.db.QueryRow(ctx, GetMediaNote, id)
|
row := q.db.QueryRow(ctx, GetMediaNote, id)
|
||||||
var i MediaNotes
|
var i MediaNotes
|
||||||
@@ -14059,59 +13858,6 @@ func (q *Queries) UpdateLibrary(ctx context.Context, arg UpdateLibraryParams) (L
|
|||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
|
|
||||||
const UpdateMediaBookmark = `-- 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 id, media_item_id, user_id, page_number, chapter_number, cfi_position, title, position, notes, created_at, dedup_key, last_modified_at, last_modified_source, device_sync_data, percentage_location, epubcfi_location, chapter_reference, deleted, deleted_at, origin_source
|
|
||||||
`
|
|
||||||
|
|
||||||
type UpdateMediaBookmarkParams struct {
|
|
||||||
ID pgtype.UUID `db:"id" json:"id"`
|
|
||||||
Title string `db:"title" json:"title"`
|
|
||||||
Notes pgtype.Text `db:"notes" json:"notes"`
|
|
||||||
Position pgtype.Text `db:"position" json:"position"`
|
|
||||||
UserID pgtype.UUID `db:"user_id" json:"user_id"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (q *Queries) UpdateMediaBookmark(ctx context.Context, arg UpdateMediaBookmarkParams) (MediaBookmarks, error) {
|
|
||||||
row := q.db.QueryRow(ctx, UpdateMediaBookmark,
|
|
||||||
arg.ID,
|
|
||||||
arg.Title,
|
|
||||||
arg.Notes,
|
|
||||||
arg.Position,
|
|
||||||
arg.UserID,
|
|
||||||
)
|
|
||||||
var i MediaBookmarks
|
|
||||||
err := row.Scan(
|
|
||||||
&i.ID,
|
|
||||||
&i.MediaItemID,
|
|
||||||
&i.UserID,
|
|
||||||
&i.PageNumber,
|
|
||||||
&i.ChapterNumber,
|
|
||||||
&i.CfiPosition,
|
|
||||||
&i.Title,
|
|
||||||
&i.Position,
|
|
||||||
&i.Notes,
|
|
||||||
&i.CreatedAt,
|
|
||||||
&i.DedupKey,
|
|
||||||
&i.LastModifiedAt,
|
|
||||||
&i.LastModifiedSource,
|
|
||||||
&i.DeviceSyncData,
|
|
||||||
&i.PercentageLocation,
|
|
||||||
&i.EpubcfiLocation,
|
|
||||||
&i.ChapterReference,
|
|
||||||
&i.Deleted,
|
|
||||||
&i.DeletedAt,
|
|
||||||
&i.OriginSource,
|
|
||||||
)
|
|
||||||
return i, err
|
|
||||||
}
|
|
||||||
|
|
||||||
const UpdateMediaBookmarkForSync = `-- name: UpdateMediaBookmarkForSync :one
|
const UpdateMediaBookmarkForSync = `-- name: UpdateMediaBookmarkForSync :one
|
||||||
UPDATE media_bookmarks SET
|
UPDATE media_bookmarks SET
|
||||||
page_number = $2,
|
page_number = $2,
|
||||||
@@ -14193,71 +13939,6 @@ func (q *Queries) UpdateMediaBookmarkForSync(ctx context.Context, arg UpdateMedi
|
|||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
|
|
||||||
const UpdateMediaHighlight = `-- 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 id, media_item_id, user_id, selection_text, start_position, end_position, color, note_id, created_at, updated_at, percentage_start, percentage_end, character_start, character_end, epubcfi_start, epubcfi_end, chapter_reference, paragraph_start, paragraph_end, panel_number, device_sync_data, dedup_key, last_modified_at, last_modified_source, note_text, deleted, deleted_at
|
|
||||||
`
|
|
||||||
|
|
||||||
type UpdateMediaHighlightParams struct {
|
|
||||||
ID pgtype.UUID `db:"id" json:"id"`
|
|
||||||
SelectionText string `db:"selection_text" json:"selection_text"`
|
|
||||||
StartPosition pgtype.Text `db:"start_position" json:"start_position"`
|
|
||||||
EndPosition pgtype.Text `db:"end_position" json:"end_position"`
|
|
||||||
Color pgtype.Text `db:"color" json:"color"`
|
|
||||||
NoteID pgtype.UUID `db:"note_id" json:"note_id"`
|
|
||||||
UserID pgtype.UUID `db:"user_id" json:"user_id"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (q *Queries) UpdateMediaHighlight(ctx context.Context, arg UpdateMediaHighlightParams) (MediaHighlights, error) {
|
|
||||||
row := q.db.QueryRow(ctx, UpdateMediaHighlight,
|
|
||||||
arg.ID,
|
|
||||||
arg.SelectionText,
|
|
||||||
arg.StartPosition,
|
|
||||||
arg.EndPosition,
|
|
||||||
arg.Color,
|
|
||||||
arg.NoteID,
|
|
||||||
arg.UserID,
|
|
||||||
)
|
|
||||||
var i MediaHighlights
|
|
||||||
err := row.Scan(
|
|
||||||
&i.ID,
|
|
||||||
&i.MediaItemID,
|
|
||||||
&i.UserID,
|
|
||||||
&i.SelectionText,
|
|
||||||
&i.StartPosition,
|
|
||||||
&i.EndPosition,
|
|
||||||
&i.Color,
|
|
||||||
&i.NoteID,
|
|
||||||
&i.CreatedAt,
|
|
||||||
&i.UpdatedAt,
|
|
||||||
&i.PercentageStart,
|
|
||||||
&i.PercentageEnd,
|
|
||||||
&i.CharacterStart,
|
|
||||||
&i.CharacterEnd,
|
|
||||||
&i.EpubcfiStart,
|
|
||||||
&i.EpubcfiEnd,
|
|
||||||
&i.ChapterReference,
|
|
||||||
&i.ParagraphStart,
|
|
||||||
&i.ParagraphEnd,
|
|
||||||
&i.PanelNumber,
|
|
||||||
&i.DeviceSyncData,
|
|
||||||
&i.DedupKey,
|
|
||||||
&i.LastModifiedAt,
|
|
||||||
&i.LastModifiedSource,
|
|
||||||
&i.NoteText,
|
|
||||||
&i.Deleted,
|
|
||||||
&i.DeletedAt,
|
|
||||||
)
|
|
||||||
return i, err
|
|
||||||
}
|
|
||||||
|
|
||||||
const UpdateMediaHighlightForSync = `-- name: UpdateMediaHighlightForSync :one
|
const UpdateMediaHighlightForSync = `-- name: UpdateMediaHighlightForSync :one
|
||||||
UPDATE media_highlights SET
|
UPDATE media_highlights SET
|
||||||
selection_text = $2,
|
selection_text = $2,
|
||||||
@@ -14943,54 +14624,6 @@ func (q *Queries) UpdateMediaItemKoboMetadata(ctx context.Context, arg UpdateMed
|
|||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
|
|
||||||
const UpdateMediaNote = `-- name: UpdateMediaNote :one
|
|
||||||
UPDATE media_notes SET
|
|
||||||
content = $2,
|
|
||||||
position = $3,
|
|
||||||
updated_at = NOW()
|
|
||||||
WHERE id = $1 AND user_id = $4
|
|
||||||
RETURNING id, media_item_id, user_id, content, position, created_at, updated_at, percentage_location, character_start, character_end, epubcfi_location, chapter_reference, paragraph_reference, device_sync_data, dedup_key, last_modified_at, last_modified_source, deleted, deleted_at
|
|
||||||
`
|
|
||||||
|
|
||||||
type UpdateMediaNoteParams struct {
|
|
||||||
ID pgtype.UUID `db:"id" json:"id"`
|
|
||||||
Content string `db:"content" json:"content"`
|
|
||||||
Position pgtype.Text `db:"position" json:"position"`
|
|
||||||
UserID pgtype.UUID `db:"user_id" json:"user_id"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (q *Queries) UpdateMediaNote(ctx context.Context, arg UpdateMediaNoteParams) (MediaNotes, error) {
|
|
||||||
row := q.db.QueryRow(ctx, UpdateMediaNote,
|
|
||||||
arg.ID,
|
|
||||||
arg.Content,
|
|
||||||
arg.Position,
|
|
||||||
arg.UserID,
|
|
||||||
)
|
|
||||||
var i MediaNotes
|
|
||||||
err := row.Scan(
|
|
||||||
&i.ID,
|
|
||||||
&i.MediaItemID,
|
|
||||||
&i.UserID,
|
|
||||||
&i.Content,
|
|
||||||
&i.Position,
|
|
||||||
&i.CreatedAt,
|
|
||||||
&i.UpdatedAt,
|
|
||||||
&i.PercentageLocation,
|
|
||||||
&i.CharacterStart,
|
|
||||||
&i.CharacterEnd,
|
|
||||||
&i.EpubcfiLocation,
|
|
||||||
&i.ChapterReference,
|
|
||||||
&i.ParagraphReference,
|
|
||||||
&i.DeviceSyncData,
|
|
||||||
&i.DedupKey,
|
|
||||||
&i.LastModifiedAt,
|
|
||||||
&i.LastModifiedSource,
|
|
||||||
&i.Deleted,
|
|
||||||
&i.DeletedAt,
|
|
||||||
)
|
|
||||||
return i, err
|
|
||||||
}
|
|
||||||
|
|
||||||
const UpdateMediaNoteForSync = `-- name: UpdateMediaNoteForSync :one
|
const UpdateMediaNoteForSync = `-- name: UpdateMediaNoteForSync :one
|
||||||
UPDATE media_notes SET
|
UPDATE media_notes SET
|
||||||
content = $2,
|
content = $2,
|
||||||
|
|||||||
@@ -920,54 +920,19 @@ ORDER BY score DESC, count DESC
|
|||||||
LIMIT sqlc.narg('limit') OFFSET sqlc.narg('offset');
|
LIMIT sqlc.narg('limit') OFFSET sqlc.narg('offset');
|
||||||
|
|
||||||
-- Media Notes queries
|
-- 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
|
-- name: GetMediaNote :one
|
||||||
SELECT * FROM media_notes WHERE id = $1;
|
SELECT * FROM media_notes WHERE id = $1;
|
||||||
|
|
||||||
-- name: GetMediaNotes :many
|
-- 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;
|
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
|
-- 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
|
-- name: GetMediaHighlight :one
|
||||||
SELECT * FROM media_highlights WHERE id = $1;
|
SELECT * FROM media_highlights WHERE id = $1;
|
||||||
|
|
||||||
-- name: GetMediaHighlights :many
|
-- 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;
|
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)
|
-- ANNOTATION SYNC QUERIES (highlights)
|
||||||
-- ============================================
|
-- ============================================
|
||||||
@@ -3038,25 +3003,6 @@ ORDER BY created_at DESC;
|
|||||||
-- name: GetMediaBookmark :one
|
-- name: GetMediaBookmark :one
|
||||||
SELECT * FROM media_bookmarks WHERE id = $1;
|
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
|
-- PROCESSING ISSUES QUERIES
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
|
|||||||
Reference in new issue
Block a user