Part 2 of the faceted plan, Phase 3 (steps 1-2). The periodic scan
issued one GetMediaItemByFilePath per scannable file (~3,094 queries
per scan in prod, nearly all answering 'unchanged, skip') plus one
GetLibraryByFolder per file for folder resolution.
- NEW media_scan_state table: the scanner's per-item fingerprint
cache. Deliberately NOT a media_items column — the library-scoped
list emits raw sqlc rows as JSON (7537063c), so scanner bookkeeping
must never leak into API payloads nor churn the model or pins.
Manifest JSONB shape v1 documented in the schema (n/s/m/h; ev
reserved for the Phase 4+ extractor-version mechanism).
- GetScanStateByLibrary: lean bulk projection (id, file_path,
file_size, archived_at, missing_scan_count, file_sha256, manifest).
archived/hash columns ride along so the skip path's archive-restore
and hash self-heal checks stay DB-free too (refines the plan's
4-column sketch; same goal, narrower invariant).
- ScanFolders: per-run reset, per-folder library cache, one bulk load
per distinct library. processMediaFile: map hit answers existence +
size + flags with zero DB reads; force-rescan and size-change
branches re-read the full row (the change path may be expensive);
write-through on create/size-change keeps later passes honest.
- Multifile folder/zip books keep their full-row lookup: it is one
query per BOOK ROOT (not per track) and needs audio_metadata for
the duration-probe check. They join the map in Phase 4, when the
manifest compare replaces their fingerprint check.
- nil map (watcher's scanDirectory path, bulk-load failure) falls
back to per-file lookups — behavior-preserving; the failure case
logged once per scan.
Test: TestScanStateBulkLoad (unchanged rescan leaves updated_at
stable; API-created rows are seen by the bulk load; size changes
still update in place). Container runner.
697 lines
50 KiB
Go
697 lines
50 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.31.1
|
|
|
|
package database
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
type Querier interface {
|
|
// COLLECTION ITEMS QUERIES
|
|
// Add book to collection
|
|
AddBookToCollection(ctx context.Context, arg AddBookToCollectionParams) (CollectionItems, error)
|
|
// A2c: playlist upsert — position set ONLY on insert, so rescans and
|
|
// re-adds never clobber the user's manual drag ordering.
|
|
AddBookToCollectionOrdered(ctx context.Context, arg AddBookToCollectionOrderedParams) (CollectionItems, error)
|
|
// ============================================
|
|
// KOBO SHELF MANAGEMENT QUERIES
|
|
// ============================================
|
|
AddBookToKoboShelf(ctx context.Context, arg AddBookToKoboShelfParams) (KoboShelves, error)
|
|
// Library Folders queries
|
|
AddLibraryFolder(ctx context.Context, arg AddLibraryFolderParams) (LibraryFolders, error)
|
|
// Second consecutive missing scan: hide the item from all browsing while
|
|
// preserving reading history in case the file returns.
|
|
ArchiveMediaItem(ctx context.Context, id pgtype.UUID) error
|
|
// Bulk update format group for all media items
|
|
BulkUpdateFormatGroups(ctx context.Context) error
|
|
BulkUpdateProgressFromSync(ctx context.Context, arg BulkUpdateProgressFromSyncParams) ([]interface{}, error)
|
|
CheckForProgressConflicts(ctx context.Context, arg CheckForProgressConflictsParams) (int64, error)
|
|
// Cleanup expired OPDS tokens
|
|
CleanupExpiredOpdsTokens(ctx context.Context) error
|
|
CleanupExpiredRefreshTokens(ctx context.Context, dollar_1 float64) error
|
|
ClearCollectionItems(ctx context.Context, collectionID pgtype.UUID) error
|
|
ClearDeviceSyncQueue(ctx context.Context, deviceID pgtype.UUID) error
|
|
ClearKoboShelf(ctx context.Context, deviceID pgtype.UUID) error
|
|
ClearKoboShelfByName(ctx context.Context, arg ClearKoboShelfByNameParams) error
|
|
// File is back on disk (by path or content hash): restore visibility and
|
|
// reset the missing-scan counter. No-op for items that were never archived.
|
|
ClearMediaItemArchive(ctx context.Context, id pgtype.UUID) error
|
|
// Reset an item to scanned defaults: clears per-field user overrides so the
|
|
// next rescan can freely overwrite user-customized metadata.
|
|
ClearMediaItemMetadataOverrides(ctx context.Context, id pgtype.UUID) error
|
|
CountAdmins(ctx context.Context) (int64, error)
|
|
CountArchivedMediaItems(ctx context.Context) (int64, error)
|
|
// A2c §3.5: distinguish "playlist complete" from "genuinely empty" — the
|
|
// dashboard renders a completion marker when hide_finished filtered
|
|
// everything out of a non-empty collection.
|
|
CountCollectionItems(ctx context.Context, collectionID pgtype.UUID) (int64, error)
|
|
// Live item count for a STATIC collection (rule-free cards on the
|
|
// collections page); same live filter as GetCollectionItems, plus the
|
|
// future-hybrid excluded exclusion and an optional library scope.
|
|
CountCollectionLiveItems(ctx context.Context, arg CountCollectionLiveItemsParams) (int32, error)
|
|
// Count unlinked books for a device
|
|
CountUnlinkedBooks(ctx context.Context, deviceID pgtype.UUID) (int64, error)
|
|
// Banner count: unresolved queue rows across the caller's own devices.
|
|
CountUnresolvedUnlinkedBooksForUser(ctx context.Context, userID pgtype.UUID) (int64, error)
|
|
CountUserDevices(ctx context.Context, userID pgtype.UUID) (int64, error)
|
|
CreateAutoResolvedSyncConflict(ctx context.Context, arg CreateAutoResolvedSyncConflictParams) (SyncConflicts, error)
|
|
// COLLECTIONS QUERIES
|
|
// Create collection
|
|
CreateCollection(ctx context.Context, arg CreateCollectionParams) (Collections, error)
|
|
// ============================================
|
|
// DEVICE MANAGEMENT & AUTH
|
|
// ============================================
|
|
// Device Registration & Management
|
|
CreateDevice(ctx context.Context, arg CreateDeviceParams) (Devices, error)
|
|
// DEVICE CATALOGS QUERIES
|
|
// Create device catalog entry
|
|
CreateDeviceCatalog(ctx context.Context, arg CreateDeviceCatalogParams) (DeviceCatalogs, error)
|
|
// DEVICE FILE ALIASES QUERIES
|
|
// Create device file alias
|
|
CreateDeviceFileAlias(ctx context.Context, arg CreateDeviceFileAliasParams) (DeviceFileAliases, error)
|
|
// DEVICE SHELF MAPPINGS QUERIES
|
|
// Create device shelf mapping
|
|
CreateDeviceShelfMapping(ctx context.Context, arg CreateDeviceShelfMappingParams) (DeviceShelfMappings, error)
|
|
CreateDictionaryEntry(ctx context.Context, arg CreateDictionaryEntryParams) (DictionaryCache, error)
|
|
// HASH CONFLICTS QUERIES
|
|
// Record a pending hash conflict (no-op if the group is already tracked, so
|
|
// resolved groups stay resolved and are never re-flagged)
|
|
CreateHashConflict(ctx context.Context, arg CreateHashConflictParams) error
|
|
// Libraries queries
|
|
CreateLibrary(ctx context.Context, arg CreateLibraryParams) (Libraries, error)
|
|
CreateMediaBookmarkFull(ctx context.Context, arg CreateMediaBookmarkFullParams) (MediaBookmarks, error)
|
|
CreateMediaHighlightFull(ctx context.Context, arg CreateMediaHighlightFullParams) (MediaHighlights, error)
|
|
// Media Items queries
|
|
// narrators/narrators_search are NOT NULL DEFAULT '{}' (A2): callers MUST
|
|
// pass empty slices, never Go nil (an explicit NULL INSERT bypasses the
|
|
// column default and 23502s). The API create handler normalizes nil.
|
|
CreateMediaItem(ctx context.Context, arg CreateMediaItemParams) (MediaItems, error)
|
|
// MEDIA ITEM FORMATS QUERIES
|
|
// Create media item format
|
|
CreateMediaItemFormat(ctx context.Context, arg CreateMediaItemFormatParams) (MediaItemFormats, error)
|
|
// API create path: race-safe create-or-detect. On a duplicate
|
|
// (library_id, file_path) this inserts NOTHING and returns no row
|
|
// (pgx.ErrNoRows) — the handler then answers 200 with the existing row
|
|
// and a duplicate flag instead of pretending it created something.
|
|
// narrators NOT NULL: callers pass empty slices, never nil (see
|
|
// CreateMediaItem note).
|
|
CreateMediaItemIfNew(ctx context.Context, arg CreateMediaItemIfNewParams) (MediaItems, error)
|
|
CreateMediaNoteFull(ctx context.Context, arg CreateMediaNoteFullParams) (MediaNotes, error)
|
|
CreateMediaRating(ctx context.Context, arg CreateMediaRatingParams) (MediaRatings, error)
|
|
// OPDS TOKENS QUERIES
|
|
// Create OPDS token
|
|
CreateOpdsToken(ctx context.Context, arg CreateOpdsTokenParams) (OpdsTokens, error)
|
|
// ============================================
|
|
// KOBO ENTITLEMENT QUERIES
|
|
// ============================================
|
|
CreateOrUpdateKoboEntitlement(ctx context.Context, arg CreateOrUpdateKoboEntitlementParams) (KoboEntitlements, error)
|
|
// ============================================================================
|
|
// PROCESSING ISSUES QUERIES
|
|
// ============================================================================
|
|
CreateProcessingIssue(ctx context.Context, arg CreateProcessingIssueParams) (ProcessingIssues, error)
|
|
// Create reading history entry
|
|
CreateReadingHistory(ctx context.Context, arg CreateReadingHistoryParams) (ReadingHistory, error)
|
|
CreateReadingSpeed(ctx context.Context, arg CreateReadingSpeedParams) (ReadingSpeed, error)
|
|
// Refresh Tokens queries
|
|
CreateRefreshToken(ctx context.Context, arg CreateRefreshTokenParams) (RefreshTokens, error)
|
|
CreateSavedFilter(ctx context.Context, arg CreateSavedFilterParams) (SavedFilters, error)
|
|
// Conflict Resolution
|
|
CreateSyncConflict(ctx context.Context, arg CreateSyncConflictParams) (SyncConflicts, error)
|
|
CreateSyncHistoryEntry(ctx context.Context, arg CreateSyncHistoryEntryParams) (SyncQueue, error)
|
|
// Sync Queue Management
|
|
CreateSyncQueueItem(ctx context.Context, arg CreateSyncQueueItemParams) (SyncQueue, error)
|
|
CreateSystemCollection(ctx context.Context, arg CreateSystemCollectionParams) (Collections, error)
|
|
// ============================================
|
|
// ENHANCED KOBO SYNC
|
|
// ============================================
|
|
// Create unlinked book entry
|
|
CreateUnlinkedBook(ctx context.Context, arg CreateUnlinkedBookParams) (UnlinkedBooks, error)
|
|
CreateUser(ctx context.Context, arg CreateUserParams) (CreateUserRow, error)
|
|
// Delete collection
|
|
DeleteCollection(ctx context.Context, id pgtype.UUID) error
|
|
DeleteDevice(ctx context.Context, id pgtype.UUID) error
|
|
DeleteDeviceByToken(ctx context.Context, authToken string) error
|
|
// Delete device catalog entry
|
|
DeleteDeviceCatalog(ctx context.Context, id pgtype.UUID) error
|
|
// Delete device file alias
|
|
DeleteDeviceFileAlias(ctx context.Context, id pgtype.UUID) error
|
|
// Delete device shelf mapping
|
|
DeleteDeviceShelfMapping(ctx context.Context, id pgtype.UUID) error
|
|
DeleteKoboEntitlement(ctx context.Context, arg DeleteKoboEntitlementParams) error
|
|
DeleteLibrary(ctx context.Context, id pgtype.UUID) error
|
|
DeleteLibraryFolder(ctx context.Context, arg DeleteLibraryFolderParams) (LibraryFolders, error)
|
|
DeleteMediaItem(ctx context.Context, id pgtype.UUID) error
|
|
// Delete media item format
|
|
DeleteMediaItemFormat(ctx context.Context, id pgtype.UUID) error
|
|
DeleteMediaRating(ctx context.Context, arg DeleteMediaRatingParams) error
|
|
DeleteMediaReview(ctx context.Context, arg DeleteMediaReviewParams) error
|
|
DeleteProcessingIssue(ctx context.Context, id pgtype.UUID) (ProcessingIssues, error)
|
|
DeleteReadingProgress(ctx context.Context, arg DeleteReadingProgressParams) error
|
|
DeleteSavedFilter(ctx context.Context, arg DeleteSavedFilterParams) (SavedFilters, error)
|
|
DeleteSyncConflict(ctx context.Context, id pgtype.UUID) error
|
|
DeleteSyncQueueItem(ctx context.Context, id pgtype.UUID) error
|
|
// Delete system config
|
|
DeleteSystemConfig(ctx context.Context, key string) error
|
|
// Delete unlinked book
|
|
DeleteUnlinkedBook(ctx context.Context, id pgtype.UUID) error
|
|
DeleteUser(ctx context.Context, id pgtype.UUID) error
|
|
DeleteUserSystemCollection(ctx context.Context, arg DeleteUserSystemCollectionParams) error
|
|
// Device existence probe for capture: the web/app progress paths
|
|
// historically stuff the user id into DeviceID (it only fed a broadcast
|
|
// label before stats); a capture row must only reference a REAL device.
|
|
DeviceExistsForUser(ctx context.Context, arg DeviceExistsForUserParams) (bool, error)
|
|
FacetAgeRatingValues(ctx context.Context, arg FacetAgeRatingValuesParams) ([]FacetAgeRatingValuesRow, error)
|
|
// Facet-value listings (faceted-navigation Batch C): top values + counts
|
|
// for the filter panel, one static query per media_items column (same
|
|
// sqlc-compatibility constraint as the Search*Values autocomplete above).
|
|
// Visibility: same family-lens join as the search query — a user's
|
|
// hidden-library rows are absent, and the handler 403s an out-of-set
|
|
// explicit library_id. Counts are v1 global-per-library (not
|
|
// recomputed under the other active filters).
|
|
FacetAuthorsValues(ctx context.Context, arg FacetAuthorsValuesParams) ([]FacetAuthorsValuesRow, error)
|
|
FacetEditionValues(ctx context.Context, arg FacetEditionValuesParams) ([]FacetEditionValuesRow, error)
|
|
FacetFormatGroupValues(ctx context.Context, arg FacetFormatGroupValuesParams) ([]FacetFormatGroupValuesRow, error)
|
|
FacetGenreValues(ctx context.Context, arg FacetGenreValuesParams) ([]FacetGenreValuesRow, error)
|
|
FacetImprintValues(ctx context.Context, arg FacetImprintValuesParams) ([]FacetImprintValuesRow, error)
|
|
FacetLanguageValues(ctx context.Context, arg FacetLanguageValuesParams) ([]FacetLanguageValuesRow, error)
|
|
FacetMangaTypeValues(ctx context.Context, arg FacetMangaTypeValuesParams) ([]FacetMangaTypeValuesRow, error)
|
|
FacetNarratorsValues(ctx context.Context, arg FacetNarratorsValuesParams) ([]FacetNarratorsValuesRow, error)
|
|
FacetPublishersValues(ctx context.Context, arg FacetPublishersValuesParams) ([]FacetPublishersValuesRow, error)
|
|
FacetReadingDirectionValues(ctx context.Context, arg FacetReadingDirectionValuesParams) ([]FacetReadingDirectionValuesRow, error)
|
|
FacetSeriesValues(ctx context.Context, arg FacetSeriesValuesParams) ([]FacetSeriesValuesRow, error)
|
|
FacetStoryArcValues(ctx context.Context, arg FacetStoryArcValuesParams) ([]FacetStoryArcValuesRow, error)
|
|
FacetTagsValues(ctx context.Context, arg FacetTagsValuesParams) ([]FacetTagsValuesRow, error)
|
|
// Find content-duplicate groups (same library + SHA-256, more than one row)
|
|
FindHashConflictGroups(ctx context.Context) ([]FindHashConflictGroupsRow, error)
|
|
GenerateKoboEntitlementId(ctx context.Context) (interface{}, error)
|
|
// ============================================
|
|
// ANNOTATION SERVE QUERIES
|
|
// ============================================
|
|
GetActiveAnnotationsForBook(ctx context.Context, arg GetActiveAnnotationsForBookParams) ([]GetActiveAnnotationsForBookRow, error)
|
|
// Get all system config
|
|
GetAllSystemConfig(ctx context.Context) ([]SystemConfig, error)
|
|
GetAllSystemSettings(ctx context.Context) ([]GetAllSystemSettingsRow, error)
|
|
GetAllSystemSettingsFull(ctx context.Context) ([]SystemSettings, error)
|
|
GetAnnotationsForBook(ctx context.Context, arg GetAnnotationsForBookParams) ([]GetAnnotationsForBookRow, error)
|
|
// Lifetime session rows for ONE book (the book-detail stats card).
|
|
GetBookReadingSessions(ctx context.Context, arg GetBookReadingSessionsParams) ([]GetBookReadingSessionsRow, error)
|
|
GetBooksByTag(ctx context.Context, arg GetBooksByTagParams) ([]MediaItems, error)
|
|
// Get collection
|
|
GetCollection(ctx context.Context, id pgtype.UUID) (Collections, error)
|
|
// A2c §2.4: playlist-collection discovery — provenance key first so a user
|
|
// rename can't spawn duplicates on the next scan.
|
|
GetCollectionByImportedSeries(ctx context.Context, arg GetCollectionByImportedSeriesParams) (Collections, error)
|
|
GetCollectionByUserAndName(ctx context.Context, arg GetCollectionByUserAndNameParams) (Collections, error)
|
|
// Get collection items
|
|
// A2c: position-first ordering (playlist reading order); un-positioned
|
|
// legacy items keep added_at ASC after the positioned tail — NOT DESC,
|
|
// which walked a playlist backwards.
|
|
GetCollectionItems(ctx context.Context, collectionID pgtype.UUID) ([]GetCollectionItemsRow, error)
|
|
// The excluded filter lives here (was: callers filtered ci.excluded in
|
|
// Go over a 69-field row + a 45-field converter to MediaItems; embed
|
|
// returns the real row so neither exists).
|
|
// A2c: position-first ordering; optional hide_finished — when the flag is
|
|
// set AND a viewer is supplied, items the viewer finished (percentage
|
|
// >= 0.999) drop out, turning the section into the reading queue head.
|
|
// viewer_user_id NULL = no progress filter (never-finished semantics for
|
|
// anonymous/legacy callers is NOT implied: hide_finished without a viewer
|
|
// is a caller bug and shows everything).
|
|
GetCollectionItemsForDashboard(ctx context.Context, arg GetCollectionItemsForDashboardParams) ([]GetCollectionItemsForDashboardRow, error)
|
|
// A2c §3.4: the collection's reading queue — first N un-finished items in
|
|
// position order. Strict playlist semantics: finished items drop out as
|
|
// they complete, so the head IS "up next". Library visibility is enforced
|
|
// by the family-lens array param (never NULL for user-facing callers).
|
|
GetCollectionUpNext(ctx context.Context, arg GetCollectionUpNextParams) ([]GetCollectionUpNextRow, error)
|
|
// Get collection with book count
|
|
GetCollectionWithBookCount(ctx context.Context, id pgtype.UUID) (GetCollectionWithBookCountRow, error)
|
|
// Get collections by user
|
|
GetCollectionsByUser(ctx context.Context, userID pgtype.UUID) ([]Collections, error)
|
|
// Get collections for book
|
|
GetCollectionsForBook(ctx context.Context, mediaItemID pgtype.UUID) ([]Collections, error)
|
|
// Smart section queries (for system collections)
|
|
GetContinueReadingItems(ctx context.Context, arg GetContinueReadingItemsParams) ([]MediaItems, error)
|
|
GetContinueSeriesItems(ctx context.Context, arg GetContinueSeriesItemsParams) ([]GetContinueSeriesItemsRow, error)
|
|
// ============================================
|
|
// CAROUSEL-STYLE DASHBOARD
|
|
// ============================================
|
|
// Dashboard preferences queries
|
|
// The handler routes by scope: a Valid library_id targets the per-library
|
|
// table below; an absent one targets user_dashboard_preferences_global
|
|
// (the "All Libraries" view). Never pass NULL here — the loose NULL match
|
|
// was removed because it returned an arbitrary library's row.
|
|
GetDashboardPreferences(ctx context.Context, arg GetDashboardPreferencesParams) (UserDashboardPreferences, error)
|
|
GetDevice(ctx context.Context, id pgtype.UUID) (Devices, error)
|
|
GetDeviceByAuthToken(ctx context.Context, authToken string) (Devices, error)
|
|
GetDeviceByIdentifier(ctx context.Context, deviceIdentifier string) (Devices, error)
|
|
// Get device catalog by Bookhoard UUID
|
|
GetDeviceCatalogByBookhoardUUID(ctx context.Context, arg GetDeviceCatalogByBookhoardUUIDParams) (DeviceCatalogs, error)
|
|
// Get device catalog by Kobo ContentId
|
|
GetDeviceCatalogByKoboContentId(ctx context.Context, koboContentID string) (DeviceCatalogs, error)
|
|
// Get device catalog entries
|
|
GetDeviceCatalogEntries(ctx context.Context, deviceID pgtype.UUID) ([]GetDeviceCatalogEntriesRow, error)
|
|
// Get device file alias
|
|
GetDeviceFileAlias(ctx context.Context, arg GetDeviceFileAliasParams) (DeviceFileAliases, error)
|
|
// Get device file alias by SHA-256
|
|
GetDeviceFileAliasBySHA256(ctx context.Context, fileSha256 pgtype.Text) (GetDeviceFileAliasBySHA256Row, error)
|
|
// Get device file aliases by device
|
|
GetDeviceFileAliasesByDevice(ctx context.Context, deviceID pgtype.UUID) ([]GetDeviceFileAliasesByDeviceRow, error)
|
|
// Get device shelf mapping
|
|
GetDeviceShelfMapping(ctx context.Context, arg GetDeviceShelfMappingParams) (DeviceShelfMappings, error)
|
|
// Get device shelf mappings
|
|
GetDeviceShelfMappings(ctx context.Context, deviceID pgtype.UUID) ([]GetDeviceShelfMappingsRow, error)
|
|
GetDictionaryEntry(ctx context.Context, word string) (DictionaryCache, error)
|
|
// Series are grouped PER LIBRARY: the same series name in two libraries
|
|
// (novels vs manga adaptations, LN splits) stays two entries. Visible
|
|
// filter enforces per-user library visibility at the source.
|
|
// Tiebreaker REQUIRED for LIMIT/OFFSET pagination: bulk imports in one
|
|
// transaction share a single NOW() timestamp, leaving many groups tied on
|
|
// MAX(created_at). Postgres does not guarantee tie order between
|
|
// executions, so page boundaries could repeat or drop series. The GROUP BY
|
|
// keys make the sort total and deterministic.
|
|
GetDistinctSeries(ctx context.Context, arg GetDistinctSeriesParams) ([]GetDistinctSeriesRow, error)
|
|
GetDistinctSeriesCount(ctx context.Context, arg GetDistinctSeriesCountParams) (int32, error)
|
|
GetFailedSyncQueueItems(ctx context.Context, limit int32) ([]SyncQueue, error)
|
|
GetFirstAdmin(ctx context.Context) (pgtype.UUID, error)
|
|
GetFirstAdminExclude(ctx context.Context, id pgtype.UUID) (GetFirstAdminExcludeRow, error)
|
|
// Global (all-libraries) scope: exactly one row per user.
|
|
GetGlobalDashboardPreferences(ctx context.Context, userID pgtype.UUID) (UserDashboardPreferencesGlobal, error)
|
|
GetHashConflict(ctx context.Context, id pgtype.UUID) (HashConflicts, error)
|
|
GetKoboEntitlementByContentId(ctx context.Context, arg GetKoboEntitlementByContentIdParams) (GetKoboEntitlementByContentIdRow, error)
|
|
GetKoboEntitlementByEntitlementId(ctx context.Context, arg GetKoboEntitlementByEntitlementIdParams) (GetKoboEntitlementByEntitlementIdRow, error)
|
|
GetKoboEntitlementsForDevice(ctx context.Context, deviceID pgtype.UUID) ([]GetKoboEntitlementsForDeviceRow, error)
|
|
GetKoboShelfBookCount(ctx context.Context, deviceID pgtype.UUID) (int64, error)
|
|
GetKoboShelfBooks(ctx context.Context, deviceID pgtype.UUID) ([]GetKoboShelfBooksRow, error)
|
|
GetKoboShelfBooksByShelfName(ctx context.Context, arg GetKoboShelfBooksByShelfNameParams) ([]GetKoboShelfBooksByShelfNameRow, error)
|
|
// Get Kobo shelves by collection
|
|
GetKoboShelvesByCollection(ctx context.Context, arg GetKoboShelvesByCollectionParams) ([]GetKoboShelvesByCollectionRow, error)
|
|
// KOReader stats conversion: the device pushes its CUMULATIVE total reading
|
|
// seconds for a book; the watermark is the highest total already converted,
|
|
// read from the koreader sessions' own device_metadata. Delta-only insertion
|
|
// means a reinstall of the device cannot double-count, and sub-threshold
|
|
// deltas are never lost (they stay folded into the next push's delta).
|
|
GetKoreaderStatWatermark(ctx context.Context, arg GetKoreaderStatWatermarkParams) (interface{}, error)
|
|
GetLibrary(ctx context.Context, id pgtype.UUID) (GetLibraryRow, error)
|
|
GetLibraryByFolder(ctx context.Context, folderPath string) (GetLibraryByFolderRow, error)
|
|
GetLibraryByFolderPathPrefix(ctx context.Context, folderPath string) (GetLibraryByFolderPathPrefixRow, error)
|
|
GetLibraryFolders(ctx context.Context, libraryID pgtype.UUID) ([]LibraryFolders, error)
|
|
GetLibraryItems(ctx context.Context, libraryID pgtype.UUID) ([]MediaItems, error)
|
|
GetLibraryType(ctx context.Context, id pgtype.UUID) (LibraryTypes, error)
|
|
GetLibraryTypeByName(ctx context.Context, name string) (LibraryTypes, error)
|
|
// Library Types queries
|
|
GetLibraryTypes(ctx context.Context) ([]LibraryTypes, error)
|
|
GetLibraryUsageAuthors(ctx context.Context, arg GetLibraryUsageAuthorsParams) ([]GetLibraryUsageAuthorsRow, error)
|
|
// ============================================================================
|
|
// LIBRARY USAGE STATS (the /stats Library tab; the StatisticsService
|
|
// LibraryUsage aggregate). media_items INVENTORY aggregates — what is in
|
|
// the library, not what was read. Every query carries BOTH filters:
|
|
// $1 = single-library scope (NULL = all visible libraries — "All")
|
|
// $2 = the requester's visible-library id set (NULL = no filter; the
|
|
// default-ALLOW family lens). A non-visible $1 is REJECTED at the
|
|
// service/handler layer with 403 — the SQL filter is defense only.
|
|
// + the healthy-item filter, matched to GetVisibleLibraryMediaCounts:
|
|
// archived_at IS NULL AND missing_scan_count = 0 (dead rows lie).
|
|
// ============================================================================
|
|
GetLibraryUsageCards(ctx context.Context, arg GetLibraryUsageCardsParams) (GetLibraryUsageCardsRow, error)
|
|
GetLibraryUsageGenres(ctx context.Context, arg GetLibraryUsageGenresParams) ([]GetLibraryUsageGenresRow, error)
|
|
GetLibraryUsageLargestItems(ctx context.Context, arg GetLibraryUsageLargestItemsParams) ([]GetLibraryUsageLargestItemsRow, error)
|
|
// The Longest Items panel, one query both modes: $3 = true ranks by
|
|
// AUDIO duration (audio present in scope), false by page_count (text).
|
|
GetLibraryUsageLongestItems(ctx context.Context, arg GetLibraryUsageLongestItemsParams) ([]GetLibraryUsageLongestItemsRow, error)
|
|
GetLibraryVisibility(ctx context.Context, arg GetLibraryVisibilityParams) (LibraryVisibility, error)
|
|
// ============================================================================
|
|
// LIBRARY WITH TYPE INFO QUERIES
|
|
// ============================================================================
|
|
GetLibraryWithType(ctx context.Context, id pgtype.UUID) (GetLibraryWithTypeRow, error)
|
|
GetMediaBookmark(ctx context.Context, id pgtype.UUID) (MediaBookmarks, error)
|
|
// ============================================
|
|
// ANNOTATION SYNC QUERIES (bookmarks)
|
|
// ============================================
|
|
GetMediaBookmarkByDedupKey(ctx context.Context, arg GetMediaBookmarkByDedupKeyParams) (MediaBookmarks, error)
|
|
GetMediaBookmarks(ctx context.Context, arg GetMediaBookmarksParams) ([]MediaBookmarks, error)
|
|
// Media Highlights queries
|
|
GetMediaHighlight(ctx context.Context, id pgtype.UUID) (MediaHighlights, error)
|
|
// ============================================
|
|
// ANNOTATION SYNC QUERIES (highlights)
|
|
// ============================================
|
|
GetMediaHighlightByDedupKey(ctx context.Context, arg GetMediaHighlightByDedupKeyParams) (MediaHighlights, error)
|
|
GetMediaHighlights(ctx context.Context, arg GetMediaHighlightsParams) ([]MediaHighlights, error)
|
|
GetMediaItem(ctx context.Context, id pgtype.UUID) (MediaItems, error)
|
|
GetMediaItemByFilePath(ctx context.Context, arg GetMediaItemByFilePathParams) (MediaItems, error)
|
|
GetMediaItemByFilePathAnyLibrary(ctx context.Context, filePath string) (MediaItems, error)
|
|
// ============================================
|
|
// KOREADER SYNC PROTOCOL
|
|
// ============================================
|
|
GetMediaItemByFilePathForSync(ctx context.Context, filePath string) (MediaItems, error)
|
|
GetMediaItemByKoboContentId(ctx context.Context, koboContentID pgtype.Text) (MediaItems, error)
|
|
GetMediaItemByLibraryAndPath(ctx context.Context, arg GetMediaItemByLibraryAndPathParams) (MediaItems, error)
|
|
// Get media item by OPF identifier
|
|
GetMediaItemByOPFIdentifier(ctx context.Context, opfIdentifier pgtype.Text) (MediaItems, error)
|
|
// Get media item by OPF UUID
|
|
GetMediaItemByOPFUUID(ctx context.Context, opfUuid pgtype.Text) (MediaItems, error)
|
|
// Get media item by SHA-256 hash
|
|
GetMediaItemBySHA256(ctx context.Context, fileSha256 pgtype.Text) (MediaItems, error)
|
|
// Get media item by SHA-256 hash within a specific library (content dedup)
|
|
GetMediaItemBySHA256AndLibrary(ctx context.Context, arg GetMediaItemBySHA256AndLibraryParams) (MediaItems, error)
|
|
// Get media item format by SHA-256
|
|
GetMediaItemFormatBySHA256(ctx context.Context, fileSha256 pgtype.Text) (MediaItemFormats, error)
|
|
// Get media item format by type
|
|
GetMediaItemFormatByType(ctx context.Context, arg GetMediaItemFormatByTypeParams) (MediaItemFormats, error)
|
|
// Get media item formats
|
|
GetMediaItemFormats(ctx context.Context, mediaItemID pgtype.UUID) ([]MediaItemFormats, error)
|
|
// Per-item user-data counts, used when choosing which duplicate copy to keep
|
|
GetMediaItemUsageCounts(ctx context.Context, mediaItemID pgtype.UUID) (GetMediaItemUsageCountsRow, error)
|
|
// Cross-library move detection: identical content registered in a different
|
|
// library of the same type (ebooks stay with ebooks, comics with comics).
|
|
// Candidates may be active copies (deliberate duplicates - leave alone) or
|
|
// hidden/archived rows whose file vanished (move candidates - the scanner
|
|
// verifies disk state before repointing).
|
|
GetMediaItemsBySHA256AndSameLibraryType(ctx context.Context, arg GetMediaItemsBySHA256AndSameLibraryTypeParams) ([]GetMediaItemsBySHA256AndSameLibraryTypeRow, error)
|
|
// Media Notes queries
|
|
GetMediaNote(ctx context.Context, id pgtype.UUID) (MediaNotes, error)
|
|
// ============================================
|
|
// ANNOTATION SYNC QUERIES (notes)
|
|
// ============================================
|
|
GetMediaNoteByDedupKey(ctx context.Context, arg GetMediaNoteByDedupKeyParams) (MediaNotes, error)
|
|
GetMediaNotes(ctx context.Context, arg GetMediaNotesParams) ([]MediaNotes, error)
|
|
GetMediaRating(ctx context.Context, arg GetMediaRatingParams) (MediaRatings, error)
|
|
GetMediaRatings(ctx context.Context, mediaItemID pgtype.UUID) ([]GetMediaRatingsRow, error)
|
|
GetMediaReview(ctx context.Context, arg GetMediaReviewParams) (MediaReviews, error)
|
|
GetNextRetryTime(ctx context.Context) (interface{}, error)
|
|
GetNotStartedItems(ctx context.Context, arg GetNotStartedItemsParams) ([]MediaItems, error)
|
|
// Get OPDS token
|
|
GetOpdsToken(ctx context.Context, token string) (GetOpdsTokenRow, error)
|
|
// Get OPDS tokens by device
|
|
GetOpdsTokensByDevice(ctx context.Context, deviceID pgtype.UUID) ([]OpdsTokens, error)
|
|
GetPanelData(ctx context.Context, arg GetPanelDataParams) (PanelData, error)
|
|
// Get most popular books for a user
|
|
GetPopularBooks(ctx context.Context, arg GetPopularBooksParams) ([]GetPopularBooksRow, error)
|
|
GetProcessingIssueStats(ctx context.Context, libraryID pgtype.UUID) (GetProcessingIssueStatsRow, error)
|
|
GetReaderSettings(ctx context.Context, userID pgtype.UUID) ([]byte, error)
|
|
// Get reading history for a user and book
|
|
GetReadingHistory(ctx context.Context, arg GetReadingHistoryParams) ([]ReadingHistory, error)
|
|
GetReadingProgress(ctx context.Context, arg GetReadingProgressParams) (ReadingProgress, error)
|
|
GetReadingSpeed(ctx context.Context, arg GetReadingSpeedParams) (ReadingSpeed, error)
|
|
GetRecentlyAddedItems(ctx context.Context, arg GetRecentlyAddedItemsParams) ([]MediaItems, error)
|
|
GetRecentlyReadItems(ctx context.Context, arg GetRecentlyReadItemsParams) ([]MediaItems, error)
|
|
GetRefreshToken(ctx context.Context, token pgtype.UUID) (GetRefreshTokenRow, error)
|
|
GetSavedFilterByID(ctx context.Context, arg GetSavedFilterByIDParams) (SavedFilters, error)
|
|
GetSavedFilters(ctx context.Context, arg GetSavedFiltersParams) ([]SavedFilters, error)
|
|
// GetScanStateByLibrary: the scanner's ONE bulk query per library scan
|
|
// (faceted plan Part 2 §2) — every item's existence + scanner-owned
|
|
// facts + sidecar manifest in a single pass. Replaces the per-file
|
|
// GetMediaItemByFilePath flood (~3,094 queries per scan in prod).
|
|
// Lean projection: metadata blobs (audio_metadata, chapter_metadata,
|
|
// authors, description...) are NEVER loaded — the skip path never
|
|
// needs them, and the change path re-reads the full row.
|
|
// archived_at + missing_scan_count + file_sha256 ride along so the
|
|
// skip path's archive-restore and hash self-heal checks stay
|
|
// DB-free too.
|
|
GetScanStateByLibrary(ctx context.Context, libraryID pgtype.UUID) ([]GetScanStateByLibraryRow, error)
|
|
// Scoped to ONE library: same-name series in different libraries are
|
|
// different stories (manga adaptations, LN splits). Callers must pass a
|
|
// library_id and verify the requester can see that library.
|
|
GetSeriesBooks(ctx context.Context, arg GetSeriesBooksParams) ([]MediaItems, error)
|
|
GetSeriesCovers(ctx context.Context, arg GetSeriesCoversParams) ([]GetSeriesCoversRow, error)
|
|
GetStuckSyncQueueItems(ctx context.Context) ([]SyncQueue, error)
|
|
GetSyncConflict(ctx context.Context, id pgtype.UUID) (SyncConflicts, error)
|
|
GetSyncQueueItem(ctx context.Context, id pgtype.UUID) (SyncQueue, error)
|
|
GetSyncQueueStats(ctx context.Context, deviceID pgtype.UUID) (GetSyncQueueStatsRow, error)
|
|
// System collections are permanent: identity is (user_id, query_type).
|
|
// Restore/reset operate IN PLACE (the row id — and everything referencing
|
|
// it: shelf mappings, prefs order, links — never churns). Deleted sections
|
|
// are TOMBSTONED (deleted_at) and stay invisible until restored.
|
|
// Unfiltered by design: restore/seed must resolve tombstoned rows too.
|
|
GetSystemCollectionByQueryType(ctx context.Context, arg GetSystemCollectionByQueryTypeParams) (Collections, error)
|
|
// Dashboard collections queries
|
|
GetSystemCollectionsForDashboard(ctx context.Context, userID pgtype.UUID) ([]Collections, error)
|
|
// SYSTEM CONFIG QUERIES
|
|
// Get system config
|
|
GetSystemConfig(ctx context.Context, key string) (SystemConfig, error)
|
|
// System Settings queries
|
|
GetSystemSetting(ctx context.Context, settingKey string) (string, error)
|
|
GetSystemSettingFull(ctx context.Context, settingKey string) (SystemSettings, error)
|
|
GetSystemTimezone(ctx context.Context) (string, error)
|
|
GetTombstonedAnnotationsForBook(ctx context.Context, arg GetTombstonedAnnotationsForBookParams) ([]GetTombstonedAnnotationsForBookRow, error)
|
|
// Most-read books for a range (minutes), for the top list.
|
|
GetTopBooksByMinutes(ctx context.Context, arg GetTopBooksByMinutesParams) ([]GetTopBooksByMinutesRow, error)
|
|
// Get universal progress for a book
|
|
GetUniversalProgress(ctx context.Context, arg GetUniversalProgressParams) (GetUniversalProgressRow, error)
|
|
// Get unlinked book by ContentId
|
|
GetUnlinkedBookByContentId(ctx context.Context, arg GetUnlinkedBookByContentIdParams) (UnlinkedBooks, error)
|
|
// Get unlinked book by ID
|
|
GetUnlinkedBookByID(ctx context.Context, id pgtype.UUID) (UnlinkedBooks, error)
|
|
// Get unlinked books for a device
|
|
GetUnlinkedBooksByDevice(ctx context.Context, deviceID pgtype.UUID) ([]GetUnlinkedBooksByDeviceRow, error)
|
|
GetUser(ctx context.Context, id pgtype.UUID) (GetUserRow, error)
|
|
GetUserByEmail(ctx context.Context, email string) (GetUserByEmailRow, error)
|
|
GetUserByEmailOrUsername(ctx context.Context, email string) (GetUserByEmailOrUsernameRow, error)
|
|
GetUserByUsername(ctx context.Context, username string) (GetUserByUsernameRow, error)
|
|
// A2c (2026-10-19): user collections are dashboard-ELIGIBLE BY DEFAULT —
|
|
// show_on_dashboard gated them forever-false (no writer ever set it on
|
|
// user rows), and hiding is the dashboard-prefs job (hidden_collections).
|
|
// The flag remains system-section provisioning state only.
|
|
GetUserCollectionsForDashboard(ctx context.Context, userID pgtype.UUID) ([]Collections, error)
|
|
// Per-device reading breakdown for a range. LEFT JOIN so pushes that
|
|
// carry no device (web reader until it identifies) still appear as one
|
|
// "unattributed" bucket — device minutes must reconcile with the totals.
|
|
GetUserDeviceBreakdown(ctx context.Context, arg GetUserDeviceBreakdownParams) ([]GetUserDeviceBreakdownRow, error)
|
|
// Get user device usage statistics
|
|
GetUserDeviceUsage(ctx context.Context, userID pgtype.UUID) ([]GetUserDeviceUsageRow, error)
|
|
GetUserForLogin(ctx context.Context, email string) (GetUserForLoginRow, error)
|
|
// Per-library aggregation for the same range.
|
|
GetUserLibraryBreakdown(ctx context.Context, arg GetUserLibraryBreakdownParams) ([]GetUserLibraryBreakdownRow, error)
|
|
GetUserMediaItemsForSync(ctx context.Context, userID pgtype.UUID) ([]GetUserMediaItemsForSyncRow, error)
|
|
GetUserPasswordHash(ctx context.Context, id pgtype.UUID) (string, error)
|
|
GetUserProgressForBooks(ctx context.Context, arg GetUserProgressForBooksParams) ([]GetUserProgressForBooksRow, error)
|
|
// Distinct ACTIVE days (any captured session) bucketed in the user's
|
|
// timezone — the streak calendar. Scoped to a long look-back so the
|
|
// "longest streak" and a current streak longer than the selected range
|
|
// are both real.
|
|
GetUserReadingActiveDays(ctx context.Context, arg GetUserReadingActiveDaysParams) ([]string, error)
|
|
// Analytics queries
|
|
// Get user reading history for analytics
|
|
GetUserReadingHistory(ctx context.Context, arg GetUserReadingHistoryParams) ([]GetUserReadingHistoryRow, error)
|
|
// STATISTICS (reading sessions) — time spent, pages, streaks, breakdowns.
|
|
// Every stats query scopes to the requesting user's VISIBLE libraries
|
|
// (family lens at the source) and single scan of reading_history.
|
|
// Full session rows for a range (summary math runs in Go: tz buckets,
|
|
// streaks, finished-book detection). The bucket/range key is the session
|
|
// END instant (the push time; NULL falls back to created_at) — the same
|
|
// value the capture stamps every write with.
|
|
GetUserReadingSessionsRange(ctx context.Context, arg GetUserReadingSessionsRangeParams) ([]GetUserReadingSessionsRangeRow, error)
|
|
GetUserVisibleLibraries(ctx context.Context, userID pgtype.UUID) ([]GetUserVisibleLibrariesRow, error)
|
|
GetVisibleLibraryMediaCounts(ctx context.Context, userID pgtype.UUID) ([]GetVisibleLibraryMediaCountsRow, error)
|
|
// Smart ("dynamic") collections: rules are evaluated LIVE at render, so
|
|
// membership comes from the candidate book set instead of collection_items.
|
|
// The set is scoped to the requesting user's visible libraries (family
|
|
// lens enforced at the source) and live items only — the same filters the
|
|
// static collection paths apply.
|
|
GetVisibleLiveMediaForRules(ctx context.Context, arg GetVisibleLiveMediaForRulesParams) ([]MediaItems, error)
|
|
HasRecentConflictResolution(ctx context.Context, arg HasRecentConflictResolutionParams) (bool, error)
|
|
IncrementSyncQueueAttempts(ctx context.Context, arg IncrementSyncQueueAttemptsParams) (SyncQueue, error)
|
|
// Check if book is in collection
|
|
IsBookInCollection(ctx context.Context, arg IsBookInCollectionParams) (bool, error)
|
|
IsBookOnKoboShelf(ctx context.Context, arg IsBookOnKoboShelfParams) (bool, error)
|
|
// Link unlinked book to media item
|
|
LinkUnlinkedBook(ctx context.Context, arg LinkUnlinkedBookParams) (UnlinkedBooks, error)
|
|
ListAllConflictsByUserAndStatus(ctx context.Context, arg ListAllConflictsByUserAndStatusParams) ([]ListAllConflictsByUserAndStatusRow, error)
|
|
ListAllSyncQueueItems(ctx context.Context, arg ListAllSyncQueueItemsParams) ([]ListAllSyncQueueItemsRow, error)
|
|
ListConflictsByUser(ctx context.Context, userID pgtype.UUID) ([]ListConflictsByUserRow, error)
|
|
// ============================================
|
|
// ANNOTATION HISTORY (deleted-annotation archive)
|
|
// ============================================
|
|
// Lists every currently-tombstoned annotation for a book regardless of the
|
|
// tombstone TTL: this backs the book page's "recently deleted" history where
|
|
// users can restore or permanently remove entries. Rows whose tombstones have
|
|
// been purged by the daily maintenance sweep no longer exist at all.
|
|
ListDeletedAnnotationsForBook(ctx context.Context, arg ListDeletedAnnotationsForBookParams) ([]ListDeletedAnnotationsForBookRow, error)
|
|
ListDevicesByType(ctx context.Context, deviceType string) ([]Devices, error)
|
|
ListDevicesByUser(ctx context.Context, userID pgtype.UUID) ([]Devices, error)
|
|
// Items hidden from libraries: either missing from disk (waiting on the
|
|
// second scan that archives them) or already archived and pending purge.
|
|
// Feeds the admin archived-items page. match_* columns identify an active
|
|
// item with identical content (same SHA-256) so the UI can offer merging the
|
|
// archived row's reading data into its active twin instead of waiting for a
|
|
// file that will never return.
|
|
ListHiddenMediaItems(ctx context.Context) ([]ListHiddenMediaItemsRow, error)
|
|
ListLibraries(ctx context.Context) ([]ListLibrariesRow, error)
|
|
ListMediaItems(ctx context.Context, arg ListMediaItemsParams) ([]ListMediaItemsRow, error)
|
|
ListMediaItemsByLibrary(ctx context.Context, libraryID pgtype.UUID) ([]ListMediaItemsByLibraryRow, error)
|
|
ListMediaItemsByLibraryIncludingArchived(ctx context.Context, libraryID pgtype.UUID) ([]ListMediaItemsByLibraryIncludingArchivedRow, error)
|
|
// List all media items sharing a SHA-256 hash within a library (hash conflict group)
|
|
ListMediaItemsBySHA256AndLibrary(ctx context.Context, arg ListMediaItemsBySHA256AndLibraryParams) ([]MediaItems, error)
|
|
// List media items that have no stored SHA-256 (imported before hashing existed)
|
|
ListMediaItemsMissingHash(ctx context.Context) ([]MediaItems, error)
|
|
ListMediaItemsSorted(ctx context.Context, arg ListMediaItemsSortedParams) ([]ListMediaItemsSortedRow, error)
|
|
ListPendingHashConflicts(ctx context.Context) ([]ListPendingHashConflictsRow, error)
|
|
// DeviceID NULL = every device's pending items (the queue processor's
|
|
// enumerator passes NULL; a bare `device_id = NULL` never matches, which
|
|
// silently disabled the offline flush until 2026-10-17).
|
|
ListPendingSyncQueueItems(ctx context.Context, arg ListPendingSyncQueueItemsParams) ([]SyncQueue, error)
|
|
ListProcessingIssuesByLibrary(ctx context.Context, libraryID pgtype.UUID) ([]ListProcessingIssuesByLibraryRow, error)
|
|
ListSyncConflictsByMediaItem(ctx context.Context, arg ListSyncConflictsByMediaItemParams) ([]SyncConflicts, error)
|
|
ListSyncConflictsByUser(ctx context.Context, userID pgtype.UUID) ([]ListSyncConflictsByUserRow, error)
|
|
// List unresolved unlinked books with pagination
|
|
ListUnresolvedUnlinkedBooks(ctx context.Context, arg ListUnresolvedUnlinkedBooksParams) ([]ListUnresolvedUnlinkedBooksRow, error)
|
|
// Page list: unresolved queue rows for the caller's own devices.
|
|
ListUnresolvedUnlinkedBooksForUser(ctx context.Context, userID pgtype.UUID) ([]ListUnresolvedUnlinkedBooksForUserRow, error)
|
|
ListUsers(ctx context.Context) ([]ListUsersRow, error)
|
|
// First consecutive scan that cannot find the file on disk.
|
|
MarkMediaItemMissing(ctx context.Context, id pgtype.UUID) error
|
|
// Content reappeared at a new location while the old path vanished: treat as
|
|
// a move. Repoints the row (and refreshes file-level fields) so reading
|
|
// history follows the book; archive/missing state is cleared separately.
|
|
MoveMediaItemFilePath(ctx context.Context, arg MoveMediaItemFilePathParams) error
|
|
// Cross-library move: identical content reappeared in a different library of
|
|
// the same type while the old file vanished. Repoints the row so reading
|
|
// history, annotations and collections follow the book; archive/missing
|
|
// state is cleared. library_type_name is refreshed by trigger.
|
|
MoveMediaItemToLibrary(ctx context.Context, arg MoveMediaItemToLibraryParams) error
|
|
// Manual bulk purge from the library admin page.
|
|
PurgeAllArchivedMediaItems(ctx context.Context) ([]PurgeAllArchivedMediaItemsRow, error)
|
|
// Retention sweep at library-scan time: hard-delete archived items older
|
|
// than the cutoff. Cascades remove reading history with the row.
|
|
PurgeExpiredArchivedMediaItems(ctx context.Context, archivedAt pgtype.Timestamptz) ([]PurgeExpiredArchivedMediaItemsRow, error)
|
|
PurgeExpiredBookmarkTombstones(ctx context.Context, deletedAt pgtype.Timestamptz) error
|
|
PurgeExpiredHighlightTombstones(ctx context.Context, deletedAt pgtype.Timestamptz) error
|
|
PurgeExpiredNoteTombstones(ctx context.Context, deletedAt pgtype.Timestamptz) error
|
|
PurgeMediaBookmarkByID(ctx context.Context, arg PurgeMediaBookmarkByIDParams) (int64, error)
|
|
// Permanent removal from the history (distinct from the TTL-driven purge,
|
|
// which is maintenance). Scoped to the owning user and book.
|
|
PurgeMediaHighlightByID(ctx context.Context, arg PurgeMediaHighlightByIDParams) (int64, error)
|
|
PurgeMediaNoteByID(ctx context.Context, arg PurgeMediaNoteByIDParams) (int64, error)
|
|
// Query media items by multiple identifiers with confidence scoring
|
|
QueryMediaItemsByIdentifiers(ctx context.Context, arg QueryMediaItemsByIdentifiersParams) ([]QueryMediaItemsByIdentifiersRow, error)
|
|
ReassignLibraries(ctx context.Context, arg ReassignLibrariesParams) error
|
|
ReassignMediaItems(ctx context.Context, arg ReassignMediaItemsParams) error
|
|
// Remove book from collection
|
|
RemoveBookFromCollection(ctx context.Context, arg RemoveBookFromCollectionParams) error
|
|
RemoveBookFromKoboShelf(ctx context.Context, arg RemoveBookFromKoboShelfParams) error
|
|
// A2c: full-order rewrite for the drag-to-reorder endpoint. The payload is
|
|
// the complete ordered id list; positions become 1..n in payload order.
|
|
ReorderCollectionItems(ctx context.Context, arg ReorderCollectionItemsParams) error
|
|
// Re-parent all child rows of p_source onto p_target (defined in schema.sql)
|
|
ReparentMediaItemChildren(ctx context.Context, arg ReparentMediaItemChildrenParams) error
|
|
ResetSystemCollectionMetadata(ctx context.Context, arg ResetSystemCollectionMetadataParams) error
|
|
ResolveHashConflict(ctx context.Context, arg ResolveHashConflictParams) error
|
|
ResolveProcessingIssue(ctx context.Context, arg ResolveProcessingIssueParams) (ProcessingIssues, error)
|
|
ResolveSyncConflict(ctx context.Context, arg ResolveSyncConflictParams) (SyncConflicts, error)
|
|
// Resolve unlinked book
|
|
ResolveUnlinkedBook(ctx context.Context, arg ResolveUnlinkedBookParams) (UnlinkedBooks, error)
|
|
RestoreMediaBookmarkByID(ctx context.Context, arg RestoreMediaBookmarkByIDParams) (int64, error)
|
|
RestoreMediaHighlightByID(ctx context.Context, arg RestoreMediaHighlightByIDParams) (int64, error)
|
|
RestoreMediaNoteByID(ctx context.Context, arg RestoreMediaNoteByIDParams) (int64, error)
|
|
// Full reset, in place: canonical metadata, back on the dashboard,
|
|
// un-tombstoned. Item assignments are cleared by the caller ("full").
|
|
RestoreSystemCollectionRow(ctx context.Context, arg RestoreSystemCollectionRowParams) (Collections, error)
|
|
RevokeAllUserRefreshTokens(ctx context.Context, userID pgtype.UUID) error
|
|
RevokeDevice(ctx context.Context, id pgtype.UUID) error
|
|
// Revoke OPDS token
|
|
RevokeOpdsToken(ctx context.Context, token string) error
|
|
RevokeRefreshToken(ctx context.Context, token pgtype.UUID) error
|
|
SearchAuthorValues(ctx context.Context, arg SearchAuthorValuesParams) ([]SearchAuthorValuesRow, error)
|
|
SearchGenreValues(ctx context.Context, arg SearchGenreValuesParams) ([]SearchGenreValuesRow, error)
|
|
SearchLanguageValues(ctx context.Context, arg SearchLanguageValuesParams) ([]SearchLanguageValuesRow, error)
|
|
// Search Media Items queries
|
|
SearchMediaItems(ctx context.Context, arg SearchMediaItemsParams) ([]SearchMediaItemsRow, error)
|
|
SearchMediaItemsUnified(ctx context.Context, arg SearchMediaItemsUnifiedParams) ([]SearchMediaItemsUnifiedRow, error)
|
|
SearchNarratorValues(ctx context.Context, arg SearchNarratorValuesParams) ([]SearchNarratorValuesRow, error)
|
|
SearchSeriesValues(ctx context.Context, arg SearchSeriesValuesParams) ([]SearchSeriesValuesRow, error)
|
|
SearchTagsValues(ctx context.Context, arg SearchTagsValuesParams) ([]SearchTagsValuesRow, error)
|
|
SetDeviceSyncEnabled(ctx context.Context, arg SetDeviceSyncEnabledParams) (Devices, error)
|
|
// Library Visibility queries
|
|
SetLibraryVisibility(ctx context.Context, arg SetLibraryVisibilityParams) (LibraryVisibility, error)
|
|
// Set system config
|
|
SetSystemConfig(ctx context.Context, arg SetSystemConfigParams) (SystemConfig, error)
|
|
SyncLibraryTypeExtensions(ctx context.Context, arg SyncLibraryTypeExtensionsParams) error
|
|
TombstoneMediaBookmarkByDedupKey(ctx context.Context, arg TombstoneMediaBookmarkByDedupKeyParams) error
|
|
TombstoneMediaBookmarkByID(ctx context.Context, arg TombstoneMediaBookmarkByIDParams) error
|
|
TombstoneMediaHighlightByDedupKey(ctx context.Context, arg TombstoneMediaHighlightByDedupKeyParams) error
|
|
TombstoneMediaHighlightByID(ctx context.Context, arg TombstoneMediaHighlightByIDParams) error
|
|
TombstoneMediaNoteByDedupKey(ctx context.Context, arg TombstoneMediaNoteByDedupKeyParams) error
|
|
TombstoneMediaNoteByID(ctx context.Context, arg TombstoneMediaNoteByIDParams) error
|
|
TombstoneSystemCollection(ctx context.Context, id pgtype.UUID) error
|
|
// Update collection
|
|
UpdateCollection(ctx context.Context, arg UpdateCollectionParams) (Collections, error)
|
|
// Replace ONLY the auto_assign_rules document (rule CRUD: read-modify-write
|
|
// of the JSONB without touching metadata stale clients did not send).
|
|
UpdateCollectionRulesJSON(ctx context.Context, arg UpdateCollectionRulesJSONParams) (Collections, error)
|
|
// A2c §2.4: provenance + playlist flags on an existing collection without
|
|
// touching the rest of the row.
|
|
UpdateCollectionViewSettings(ctx context.Context, arg UpdateCollectionViewSettingsParams) error
|
|
UpdateDashboardPreferences(ctx context.Context, arg UpdateDashboardPreferencesParams) (UserDashboardPreferences, error)
|
|
UpdateDevice(ctx context.Context, arg UpdateDeviceParams) (Devices, error)
|
|
UpdateDeviceAuthToken(ctx context.Context, arg UpdateDeviceAuthTokenParams) (Devices, error)
|
|
// Update device catalog availability
|
|
UpdateDeviceCatalogAvailability(ctx context.Context, arg UpdateDeviceCatalogAvailabilityParams) error
|
|
// Update device file alias
|
|
UpdateDeviceFileAlias(ctx context.Context, arg UpdateDeviceFileAliasParams) (DeviceFileAliases, error)
|
|
UpdateDeviceLastSeen(ctx context.Context, id pgtype.UUID) (Devices, error)
|
|
UpdateDeviceLastSync(ctx context.Context, id pgtype.UUID) (Devices, error)
|
|
// Update device shelf mapping
|
|
UpdateDeviceShelfMapping(ctx context.Context, arg UpdateDeviceShelfMappingParams) (DeviceShelfMappings, error)
|
|
UpdateDeviceSyncTimestamp(ctx context.Context, id pgtype.UUID) (Devices, error)
|
|
UpdateDictionaryAccessed(ctx context.Context, word string) (DictionaryCache, error)
|
|
UpdateEmail(ctx context.Context, arg UpdateEmailParams) error
|
|
UpdateKoboEntitlementRevision(ctx context.Context, arg UpdateKoboEntitlementRevisionParams) error
|
|
UpdateKoboEntitlementStatus(ctx context.Context, arg UpdateKoboEntitlementStatusParams) error
|
|
UpdateKoboShelfBookPosition(ctx context.Context, arg UpdateKoboShelfBookPositionParams) error
|
|
// Update Kobo shelves to support collections
|
|
UpdateKoboShelfCollection(ctx context.Context, arg UpdateKoboShelfCollectionParams) (KoboShelves, error)
|
|
UpdateLibrary(ctx context.Context, arg UpdateLibraryParams) (Libraries, error)
|
|
UpdateMediaBookmarkForSync(ctx context.Context, arg UpdateMediaBookmarkForSyncParams) (MediaBookmarks, error)
|
|
UpdateMediaHighlightForSync(ctx context.Context, arg UpdateMediaHighlightForSyncParams) (MediaHighlights, error)
|
|
UpdateMediaItem(ctx context.Context, arg UpdateMediaItemParams) (MediaItems, error)
|
|
// Focused refresh for multi-file audiobooks (folder-of-tracks / zip
|
|
// books): rescans recompute the track manifest and the aggregate facts
|
|
// that follow from it. Editorial fields stay untouched — admins may have
|
|
// edited title/narrators after ingest.
|
|
UpdateMediaItemAudioBookPayload(ctx context.Context, arg UpdateMediaItemAudioBookPayloadParams) (UpdateMediaItemAudioBookPayloadRow, error)
|
|
UpdateMediaItemChapterMetadata(ctx context.Context, arg UpdateMediaItemChapterMetadataParams) (MediaItems, error)
|
|
// Update media item format
|
|
UpdateMediaItemFormat(ctx context.Context, arg UpdateMediaItemFormatParams) (MediaItemFormats, error)
|
|
// ============================================
|
|
// FORMAT DETECTION & PROGRESS
|
|
// ============================================
|
|
// Update media item format group information
|
|
UpdateMediaItemFormatGroup(ctx context.Context, arg UpdateMediaItemFormatGroupParams) error
|
|
// Media Items Admin Operations
|
|
// ============================================
|
|
// UNIVERSAL BOOK IDENTIFIERS
|
|
// ============================================
|
|
// Update media item with universal identifiers
|
|
UpdateMediaItemIdentifiers(ctx context.Context, arg UpdateMediaItemIdentifiersParams) (MediaItems, error)
|
|
UpdateMediaItemKoboMetadata(ctx context.Context, arg UpdateMediaItemKoboMetadataParams) (MediaItems, error)
|
|
UpdateMediaNoteForSync(ctx context.Context, arg UpdateMediaNoteForSyncParams) (MediaNotes, error)
|
|
UpdateMediaRating(ctx context.Context, arg UpdateMediaRatingParams) (MediaRatings, error)
|
|
UpdatePassword(ctx context.Context, arg UpdatePasswordParams) error
|
|
UpdateReadingProgress(ctx context.Context, arg UpdateReadingProgressParams) (ReadingProgress, error)
|
|
UpdateReadingSpeed(ctx context.Context, arg UpdateReadingSpeedParams) (ReadingSpeed, error)
|
|
UpdateSavedFilter(ctx context.Context, arg UpdateSavedFilterParams) (SavedFilters, error)
|
|
UpdateSyncQueueItemStatus(ctx context.Context, arg UpdateSyncQueueItemStatusParams) (SyncQueue, error)
|
|
UpdateSystemSetting(ctx context.Context, arg UpdateSystemSettingParams) error
|
|
// Update universal progress
|
|
UpdateUniversalProgress(ctx context.Context, arg UpdateUniversalProgressParams) (ReadingProgress, error)
|
|
UpdateUserMaxDevices(ctx context.Context, arg UpdateUserMaxDevicesParams) (Users, error)
|
|
UpdateUserProfile(ctx context.Context, arg UpdateUserProfileParams) error
|
|
UpdateUserRole(ctx context.Context, arg UpdateUserRoleParams) (UpdateUserRoleRow, error)
|
|
UpdateUserTheme(ctx context.Context, arg UpdateUserThemeParams) error
|
|
UpdateUserTimezone(ctx context.Context, arg UpdateUserTimezoneParams) error
|
|
UpdateUsername(ctx context.Context, arg UpdateUsernameParams) error
|
|
UpsertDashboardPreferences(ctx context.Context, arg UpsertDashboardPreferencesParams) (UserDashboardPreferences, error)
|
|
UpsertGlobalDashboardPreferences(ctx context.Context, arg UpsertGlobalDashboardPreferencesParams) (UserDashboardPreferencesGlobal, error)
|
|
UpsertMediaReview(ctx context.Context, arg UpsertMediaReviewParams) (MediaReviews, error)
|
|
UpsertPanelData(ctx context.Context, arg UpsertPanelDataParams) (PanelData, error)
|
|
UpsertReaderSettings(ctx context.Context, arg UpsertReaderSettingsParams) (ReaderSettings, error)
|
|
UpsertSystemSetting(ctx context.Context, arg UpsertSystemSettingParams) (SystemSettings, error)
|
|
// Ingest: insert or refresh the queue row for a device file that could not
|
|
// be identified. One row per (device, content_id); re-syncs bump last_seen.
|
|
UpsertUnlinkedBook(ctx context.Context, arg UpsertUnlinkedBookParams) (UnlinkedBooks, error)
|
|
}
|
|
|
|
var _ Querier = (*Queries)(nil)
|