diff --git a/internal/database/querier.go b/internal/database/querier.go index a9022d7..7789198 100644 --- a/internal/database/querier.go +++ b/internal/database/querier.go @@ -49,8 +49,6 @@ type Querier interface { // DEVICE SHELF MAPPINGS QUERIES // Create device shelf mapping CreateDeviceShelfMapping(ctx context.Context, arg CreateDeviceShelfMappingParams) (DeviceShelfMappings, error) - // Backward compatibility - Ebook Notes queries (using views) - CreateEbookNote(ctx context.Context, arg CreateEbookNoteParams) (MediaNotes, error) // Libraries queries CreateLibrary(ctx context.Context, arg CreateLibraryParams) (Libraries, error) // Media Highlights queries @@ -95,7 +93,6 @@ type Querier interface { DeleteDeviceFileAlias(ctx context.Context, id pgtype.UUID) error // Delete device shelf mapping DeleteDeviceShelfMapping(ctx context.Context, id pgtype.UUID) error - DeleteEbookNote(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) @@ -283,7 +280,6 @@ type Querier interface { // Update device shelf mapping UpdateDeviceShelfMapping(ctx context.Context, arg UpdateDeviceShelfMappingParams) (DeviceShelfMappings, error) UpdateDeviceSyncTimestamp(ctx context.Context, id pgtype.UUID) (Devices, error) - UpdateEbookNote(ctx context.Context, arg UpdateEbookNoteParams) (MediaNotes, error) UpdateEmail(ctx context.Context, arg UpdateEmailParams) error UpdateKoboEntitlementRevision(ctx context.Context, arg UpdateKoboEntitlementRevisionParams) error UpdateKoboEntitlementStatus(ctx context.Context, arg UpdateKoboEntitlementStatusParams) error diff --git a/internal/database/queries.sql.go b/internal/database/queries.sql.go index ea35b6a..6efc70e 100644 --- a/internal/database/queries.sql.go +++ b/internal/database/queries.sql.go @@ -455,47 +455,6 @@ func (q *Queries) CreateDeviceShelfMapping(ctx context.Context, arg CreateDevice return i, err } -const CreateEbookNote = `-- name: CreateEbookNote :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 -` - -type CreateEbookNoteParams 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"` -} - -// Backward compatibility - Ebook Notes queries (using views) -func (q *Queries) CreateEbookNote(ctx context.Context, arg CreateEbookNoteParams) (MediaNotes, error) { - row := q.db.QueryRow(ctx, CreateEbookNote, - 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, - ) - return i, err -} - const CreateLibrary = `-- name: CreateLibrary :one INSERT INTO libraries (name, description, library_type_id, created_by_admin_id) VALUES ($1, $2, $3, $4) @@ -1267,15 +1226,6 @@ func (q *Queries) DeleteDeviceShelfMapping(ctx context.Context, id pgtype.UUID) return err } -const DeleteEbookNote = `-- name: DeleteEbookNote :exec -DELETE FROM media_notes WHERE id = $1 -` - -func (q *Queries) DeleteEbookNote(ctx context.Context, id pgtype.UUID) error { - _, err := q.db.Exec(ctx, DeleteEbookNote, id) - return err -} - const DeleteKoboEntitlement = `-- name: DeleteKoboEntitlement :exec DELETE FROM kobo_entitlements WHERE device_id = $1 AND entitlement_id = $2 ` @@ -6747,43 +6697,6 @@ func (q *Queries) UpdateDeviceSyncTimestamp(ctx context.Context, id pgtype.UUID) return i, err } -const UpdateEbookNote = `-- name: UpdateEbookNote :one -UPDATE media_notes SET - content = $2, - position = $3, - updated_at = NOW() -WHERE id = $1 -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 -` - -type UpdateEbookNoteParams struct { - ID pgtype.UUID `db:"id" json:"id"` - Content string `db:"content" json:"content"` - Position pgtype.Text `db:"position" json:"position"` -} - -func (q *Queries) UpdateEbookNote(ctx context.Context, arg UpdateEbookNoteParams) (MediaNotes, error) { - row := q.db.QueryRow(ctx, UpdateEbookNote, arg.ID, 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, - ) - return i, err -} - const UpdateEmail = `-- name: UpdateEmail :exec UPDATE users SET email = $2, updated_at = NOW() WHERE id = $1 ` diff --git a/internal/database/queries/queries.sql b/internal/database/queries/queries.sql index e9759c1..116ef35 100644 --- a/internal/database/queries/queries.sql +++ b/internal/database/queries/queries.sql @@ -470,23 +470,6 @@ RETURNING *; -- name: DeleteMediaHighlight :exec DELETE FROM media_highlights WHERE id = $1; --- Backward compatibility - Ebook Notes queries (using views) --- name: CreateEbookNote :one -INSERT INTO media_notes (media_item_id, user_id, content, position) -VALUES ($1, $2, $3, $4) -RETURNING *; - --- name: UpdateEbookNote :one -UPDATE media_notes SET - content = $2, - position = $3, - updated_at = NOW() -WHERE id = $1 -RETURNING *; - --- name: DeleteEbookNote :exec -DELETE FROM media_notes WHERE id = $1; - -- Refresh Tokens queries -- name: CreateRefreshToken :one INSERT INTO refresh_tokens (user_id, token, expires_at)