Rename project module and database references: Bookmann → Bookhoard
Core infrastructure changes: - Update Go module name: bookmann → bookhoard - Rename database schema references and comments - Update database column names: bookmann_uuid → bookhoard_uuid - Rename SQL query functions: GetDeviceCatalogByBookmannUUID → GetDeviceCatalogByBookhoardUUID - Update configuration defaults This is part 1 of the project rename to Bookhoard.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
-- Consolidated Bookmann Database Schema
|
||||
-- This file contains the complete current schema for the Bookmann media library management system
|
||||
-- Consolidated Bookhoard Database Schema
|
||||
-- This file contains the complete current schema for the Bookhoard media library management system
|
||||
|
||||
-- Create library types table
|
||||
CREATE TABLE library_types (
|
||||
@@ -848,7 +848,7 @@ CREATE TABLE IF NOT EXISTS collection_items (
|
||||
CREATE INDEX IF NOT EXISTS idx_collection_items_collection ON collection_items(collection_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_collection_items_media ON collection_items(media_item_id);
|
||||
|
||||
-- Create device_shelf_mappings table (map Bookmann collections to device-specific shelf names)
|
||||
-- Create device_shelf_mappings table (map Bookhoard collections to device-specific shelf names)
|
||||
CREATE TABLE IF NOT EXISTS device_shelf_mappings (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
collection_id UUID NOT NULL REFERENCES collections(id) ON DELETE CASCADE,
|
||||
@@ -862,7 +862,7 @@ CREATE TABLE IF NOT EXISTS device_shelf_mappings (
|
||||
CREATE INDEX IF NOT EXISTS idx_device_shelf_mappings_collection ON device_shelf_mappings(collection_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_device_shelf_mappings_device ON device_shelf_mappings(device_id);
|
||||
|
||||
-- Create device_catalogs table (track OPDS downloads and map Bookmann UUIDs to device ContentIds)
|
||||
-- Create device_catalogs table (track OPDS downloads and map Bookhoard UUIDs to device ContentIds)
|
||||
CREATE TABLE IF NOT EXISTS device_catalogs (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
device_id UUID NOT NULL REFERENCES devices(id) ON DELETE CASCADE,
|
||||
|
||||
@@ -30,7 +30,7 @@ func LoadConfig() *Config {
|
||||
DatabasePort: getEnv("DATABASE_PORT", "5432"),
|
||||
DatabaseUser: getEnv("DATABASE_USER", "postgres"),
|
||||
DatabasePassword: getEnv("DATABASE_PASSWORD", "password"),
|
||||
DatabaseName: getEnv("DATABASE_NAME", "bookmann"),
|
||||
DatabaseName: getEnv("DATABASE_NAME", "bookhoard"),
|
||||
JWTSecret: getEnv("JWT_SECRET", "your-secret-key"),
|
||||
UploadPath: getEnv("UPLOAD_PATH", "./uploads"),
|
||||
TestMode: getEnvBool("TEST_MODE", false),
|
||||
|
||||
@@ -32,7 +32,7 @@ type DeviceCatalogs struct {
|
||||
ID pgtype.UUID `db:"id" json:"id"`
|
||||
DeviceID pgtype.UUID `db:"device_id" json:"device_id"`
|
||||
MediaItemID pgtype.UUID `db:"media_item_id" json:"media_item_id"`
|
||||
BookmannUuid pgtype.UUID `db:"bookmann_uuid" json:"bookmann_uuid"`
|
||||
BookmannUuid pgtype.UUID `db:"bookhoard_uuid" json:"bookhoard_uuid"`
|
||||
KoboContentID string `db:"kobo_content_id" json:"kobo_content_id"`
|
||||
ContentIDType pgtype.Text `db:"content_id_type" json:"content_id_type"`
|
||||
Available pgtype.Bool `db:"available" json:"available"`
|
||||
|
||||
@@ -131,7 +131,7 @@ type Querier interface {
|
||||
GetDeviceByAuthToken(ctx context.Context, authToken string) (Devices, error)
|
||||
GetDeviceByIdentifier(ctx context.Context, deviceIdentifier string) (Devices, error)
|
||||
// Get device catalog by Bookmann UUID
|
||||
GetDeviceCatalogByBookmannUUID(ctx context.Context, arg GetDeviceCatalogByBookmannUUIDParams) (DeviceCatalogs, error)
|
||||
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
|
||||
|
||||
@@ -329,20 +329,20 @@ func (q *Queries) CreateDevice(ctx context.Context, arg CreateDeviceParams) (Dev
|
||||
|
||||
const CreateDeviceCatalog = `-- name: CreateDeviceCatalog :one
|
||||
|
||||
INSERT INTO device_catalogs (device_id, media_item_id, bookmann_uuid, kobo_content_id, content_id_type, available, delivery_date, delivery_method)
|
||||
INSERT INTO device_catalogs (device_id, media_item_id, bookhoard_uuid, kobo_content_id, content_id_type, available, delivery_date, delivery_method)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
||||
ON CONFLICT (device_id, kobo_content_id)
|
||||
DO UPDATE SET
|
||||
available = EXCLUDED.available,
|
||||
delivery_date = COALESCE(EXCLUDED.delivery_date, device_catalogs.delivery_date),
|
||||
delivery_method = EXCLUDED.delivery_method
|
||||
RETURNING id, device_id, media_item_id, bookmann_uuid, kobo_content_id, content_id_type, available, delivery_date, delivery_method
|
||||
RETURNING id, device_id, media_item_id, bookhoard_uuid, kobo_content_id, content_id_type, available, delivery_date, delivery_method
|
||||
`
|
||||
|
||||
type CreateDeviceCatalogParams struct {
|
||||
DeviceID pgtype.UUID `db:"device_id" json:"device_id"`
|
||||
MediaItemID pgtype.UUID `db:"media_item_id" json:"media_item_id"`
|
||||
BookmannUuid pgtype.UUID `db:"bookmann_uuid" json:"bookmann_uuid"`
|
||||
BookmannUuid pgtype.UUID `db:"bookhoard_uuid" json:"bookhoard_uuid"`
|
||||
KoboContentID string `db:"kobo_content_id" json:"kobo_content_id"`
|
||||
ContentIDType pgtype.Text `db:"content_id_type" json:"content_id_type"`
|
||||
Available pgtype.Bool `db:"available" json:"available"`
|
||||
@@ -1819,18 +1819,18 @@ func (q *Queries) GetDeviceByIdentifier(ctx context.Context, deviceIdentifier st
|
||||
return i, err
|
||||
}
|
||||
|
||||
const GetDeviceCatalogByBookmannUUID = `-- name: GetDeviceCatalogByBookmannUUID :one
|
||||
SELECT id, device_id, media_item_id, bookmann_uuid, kobo_content_id, content_id_type, available, delivery_date, delivery_method FROM device_catalogs WHERE device_id = $1 AND bookmann_uuid = $2
|
||||
const GetDeviceCatalogByBookhoardUUID = `-- name: GetDeviceCatalogByBookhoardUUID :one
|
||||
SELECT id, device_id, media_item_id, bookhoard_uuid, kobo_content_id, content_id_type, available, delivery_date, delivery_method FROM device_catalogs WHERE device_id = $1 AND bookhoard_uuid = $2
|
||||
`
|
||||
|
||||
type GetDeviceCatalogByBookmannUUIDParams struct {
|
||||
type GetDeviceCatalogByBookhoardUUIDParams struct {
|
||||
DeviceID pgtype.UUID `db:"device_id" json:"device_id"`
|
||||
BookmannUuid pgtype.UUID `db:"bookmann_uuid" json:"bookmann_uuid"`
|
||||
BookmannUuid pgtype.UUID `db:"bookhoard_uuid" json:"bookhoard_uuid"`
|
||||
}
|
||||
|
||||
// Get device catalog by Bookmann UUID
|
||||
func (q *Queries) GetDeviceCatalogByBookmannUUID(ctx context.Context, arg GetDeviceCatalogByBookmannUUIDParams) (DeviceCatalogs, error) {
|
||||
row := q.db.QueryRow(ctx, GetDeviceCatalogByBookmannUUID, arg.DeviceID, arg.BookmannUuid)
|
||||
func (q *Queries) GetDeviceCatalogByBookhoardUUID(ctx context.Context, arg GetDeviceCatalogByBookhoardUUIDParams) (DeviceCatalogs, error) {
|
||||
row := q.db.QueryRow(ctx, GetDeviceCatalogByBookhoardUUID, arg.DeviceID, arg.BookmannUuid)
|
||||
var i DeviceCatalogs
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
@@ -1847,7 +1847,7 @@ func (q *Queries) GetDeviceCatalogByBookmannUUID(ctx context.Context, arg GetDev
|
||||
}
|
||||
|
||||
const GetDeviceCatalogByKoboContentId = `-- name: GetDeviceCatalogByKoboContentId :one
|
||||
SELECT id, device_id, media_item_id, bookmann_uuid, kobo_content_id, content_id_type, available, delivery_date, delivery_method FROM device_catalogs WHERE kobo_content_id = $1
|
||||
SELECT id, device_id, media_item_id, bookhoard_uuid, kobo_content_id, content_id_type, available, delivery_date, delivery_method FROM device_catalogs WHERE kobo_content_id = $1
|
||||
`
|
||||
|
||||
// Get device catalog by Kobo ContentId
|
||||
@@ -1869,7 +1869,7 @@ func (q *Queries) GetDeviceCatalogByKoboContentId(ctx context.Context, koboConte
|
||||
}
|
||||
|
||||
const GetDeviceCatalogEntries = `-- name: GetDeviceCatalogEntries :many
|
||||
SELECT dc.id, dc.device_id, dc.media_item_id, dc.bookmann_uuid, dc.kobo_content_id, dc.content_id_type, dc.available, dc.delivery_date, dc.delivery_method, mi.title, mi.author
|
||||
SELECT dc.id, dc.device_id, dc.media_item_id, dc.bookhoard_uuid, dc.kobo_content_id, dc.content_id_type, dc.available, dc.delivery_date, dc.delivery_method, mi.title, mi.author
|
||||
FROM device_catalogs dc
|
||||
JOIN media_items mi ON dc.media_item_id = mi.id
|
||||
WHERE dc.device_id = $1 AND dc.available = true
|
||||
@@ -1880,7 +1880,7 @@ type GetDeviceCatalogEntriesRow struct {
|
||||
ID pgtype.UUID `db:"id" json:"id"`
|
||||
DeviceID pgtype.UUID `db:"device_id" json:"device_id"`
|
||||
MediaItemID pgtype.UUID `db:"media_item_id" json:"media_item_id"`
|
||||
BookmannUuid pgtype.UUID `db:"bookmann_uuid" json:"bookmann_uuid"`
|
||||
BookmannUuid pgtype.UUID `db:"bookhoard_uuid" json:"bookhoard_uuid"`
|
||||
KoboContentID string `db:"kobo_content_id" json:"kobo_content_id"`
|
||||
ContentIDType pgtype.Text `db:"content_id_type" json:"content_id_type"`
|
||||
Available pgtype.Bool `db:"available" json:"available"`
|
||||
|
||||
@@ -1388,8 +1388,8 @@ DO UPDATE SET
|
||||
delivery_method = EXCLUDED.delivery_method
|
||||
RETURNING *;
|
||||
|
||||
-- Get device catalog by Bookmann UUID
|
||||
-- name: GetDeviceCatalogByBookmannUUID :one
|
||||
-- Get device catalog by Bookhoard UUID
|
||||
-- name: GetDeviceCatalogByBookhoardUUID :one
|
||||
SELECT * FROM device_catalogs WHERE device_id = $1 AND bookmann_uuid = $2;
|
||||
|
||||
-- Get device catalog by Kobo ContentId
|
||||
|
||||
Reference in New Issue
Block a user