From 5b9f21a5923f74e09b7fd8a42f849f909a938059 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Sun, 1 Feb 2026 16:24:58 -0500 Subject: [PATCH] Final cleanup: Update remaining comments and variable names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes: - Update comments: "Bookmann UUID" → "Bookhoard UUID" - Rename sidecar struct field: Bookmann → Bookhoard - Update type names: SidecarBookmannConfig → SidecarBookhoardConfig - Fix test database name in queue_test.go - Fix uppercase env var examples in KOBO_SETUP.md Internal Go variable names (BookmannUuid, bookmannUUID) left unchanged as they're implementation details that don't affect functionality. Part of project rename to Bookhoard. --- docs/devices/KOBO_SETUP.md | 8 ++++---- internal/database/querier.go | 2 +- internal/database/queries.sql.go | 2 +- internal/handlers/kobo.go | 6 +++--- internal/handlers/sidecar.go | 14 +++++++------- internal/services/book_matching.go | 4 ++-- internal/services/book_matching_test.go | 2 +- internal/sync/queue_test.go | 2 +- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/docs/devices/KOBO_SETUP.md b/docs/devices/KOBO_SETUP.md index 76906fe..e1e0c19 100644 --- a/docs/devices/KOBO_SETUP.md +++ b/docs/devices/KOBO_SETUP.md @@ -113,14 +113,14 @@ AutoSyncEnabled=true SyncFrequency=5 # Authentication -Username=YOUR_BOOKMANN_USERNAME -Password=YOUR_BOOKMANN_PASSWORD +Username=YOUR_BOOKHOARD_USERNAME +Password=YOUR_BOOKHOARD_PASSWORD ``` **Replace the following with your actual values**: - `YOUR_COMPUTER_IP`: Your computer's local IP address (e.g., 192.168.1.100) -- `YOUR_BOOKMANN_USERNAME`: Your Bookhoard email or username -- `YOUR_BOOKMANN_PASSWORD`: Your Bookhoard password +- `YOUR_BOOKHOARD_USERNAME`: Your Bookhoard email or username +- `YOUR_BOOKHOARD_PASSWORD`: Your Bookhoard password **Example configuration:** ```ini diff --git a/internal/database/querier.go b/internal/database/querier.go index 1bd5ceb..a9022d7 100644 --- a/internal/database/querier.go +++ b/internal/database/querier.go @@ -130,7 +130,7 @@ type Querier interface { 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 Bookmann UUID + // 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) diff --git a/internal/database/queries.sql.go b/internal/database/queries.sql.go index a24ad60..f786c50 100644 --- a/internal/database/queries.sql.go +++ b/internal/database/queries.sql.go @@ -1828,7 +1828,7 @@ type GetDeviceCatalogByBookhoardUUIDParams struct { BookmannUuid pgtype.UUID `db:"bookhoard_uuid" json:"bookhoard_uuid"` } -// Get device catalog by Bookmann UUID +// Get device catalog by Bookhoard UUID func (q *Queries) GetDeviceCatalogByBookhoardUUID(ctx context.Context, arg GetDeviceCatalogByBookhoardUUIDParams) (DeviceCatalogs, error) { row := q.db.QueryRow(ctx, GetDeviceCatalogByBookhoardUUID, arg.DeviceID, arg.BookmannUuid) var i DeviceCatalogs diff --git a/internal/handlers/kobo.go b/internal/handlers/kobo.go index b7a3314..723e1d6 100644 --- a/internal/handlers/kobo.go +++ b/internal/handlers/kobo.go @@ -25,13 +25,13 @@ func NewKoboHandler(db *database.Queries, connManager *wsync.ConnectionManager) return &KoboHandler{db: db, connManager: connManager} } -// mapContentIdToBookhoardUUID maps Kobo ContentId to Bookmann UUID with multiple fallback strategies +// mapContentIdToBookhoardUUID maps Kobo ContentId to Bookhoard UUID with multiple fallback strategies // Phase 6: Enhanced Kobo Sync - ContentId Mapping Logic func (h *KoboHandler) mapContentIdToBookhoardUUID(ctx echo.Context, contentId string, deviceID uuid.UUID) (uuid.UUID, error, string) { // Step 1: Try direct ContentId lookup in device_catalogs table catalog, err := h.db.GetDeviceCatalogByKoboContentId(ctx.Request().Context(), contentId) if err == nil && catalog.ID.Valid { - // Found! Use canonical Bookmann UUID + // Found! Use canonical Bookhoard UUID return uuid.UUID(catalog.BookmannUuid.Bytes), nil, "catalog_match" } @@ -79,7 +79,7 @@ func (h *KoboHandler) mapContentIdToBookhoardUUID(ctx echo.Context, contentId st return uuid.Nil, fmt.Errorf("unlinked book: ContentId %s not found", contentId), "unlinked" } -// mapBookhoardUUIDToKoboContentId maps Bookmann UUID to Kobo ContentId +// mapBookhoardUUIDToKoboContentId maps Bookhoard UUID to Kobo ContentId // Creates new entry in device_catalogs if not exists func (h *KoboHandler) mapBookhoardUUIDToKoboContentId(c echo.Context, bookmannUUID uuid.UUID, deviceID uuid.UUID) (string, error) { // Check if catalog entry already exists diff --git a/internal/handlers/sidecar.go b/internal/handlers/sidecar.go index fdff3da..5cbb9cc 100644 --- a/internal/handlers/sidecar.go +++ b/internal/handlers/sidecar.go @@ -22,7 +22,7 @@ func NewSidecarHandler(db *database.Queries) *SidecarHandler { type SidecarConfig struct { Version string `json:"version"` - Bookmann SidecarBookmannConfig `json:"bookhoard"` + Bookhoard SidecarBookhoardConfig `json:"bookhoard"` Books map[string]SidecarBook `json:"books"` Collections []SidecarCollection `json:"collections"` OPDSEnabled bool `json:"opds_enabled"` @@ -30,7 +30,7 @@ type SidecarConfig struct { LastUpdated string `json:"last_updated"` } -type SidecarBookmannConfig struct { +type SidecarBookhoardConfig struct { OPDSCatalog string `json:"opds_catalog"` SyncAPI string `json:"sync_api"` OPDSBaseURL string `json:"opds_base_url"` @@ -40,7 +40,7 @@ type SidecarBookmannConfig struct { } type SidecarBook struct { - BookhoardUUID string `json:"bookhoard_uuid"` + BookhoardUUID string `json:"bookhoard_uuid"` Title string `json:"title"` Author string `json:"author"` AvailableFormats []string `json:"available_formats"` @@ -119,7 +119,7 @@ func (h *SidecarHandler) GetSidecarConfig(c echo.Context) error { } books[key] = SidecarBook{ - BookhoardUUID: bookUUID, + BookhoardUUID: bookUUID, Title: item.Title, Author: author, AvailableFormats: availableFormats, @@ -169,7 +169,7 @@ func (h *SidecarHandler) GetSidecarConfig(c echo.Context) error { // Build sidecar config config := SidecarConfig{ Version: "1.0", - Bookmann: SidecarBookmannConfig{ + Bookhoard: SidecarBookhoardConfig{ OPDSCatalog: opdsCatalogURL, SyncAPI: syncAPIURL, OPDSBaseURL: opdsBaseURL.Value, @@ -254,7 +254,7 @@ func (h *SidecarHandler) DownloadSidecarConfig(c echo.Context) error { } books[key] = SidecarBook{ - BookhoardUUID: bookUUID, + BookhoardUUID: bookUUID, Title: item.Title, Author: author, AvailableFormats: availableFormats, @@ -300,7 +300,7 @@ func (h *SidecarHandler) DownloadSidecarConfig(c echo.Context) error { sidecarConfig = SidecarConfig{ Version: "1.0", - Bookmann: SidecarBookmannConfig{ + Bookhoard: SidecarBookhoardConfig{ OPDSCatalog: opdsCatalogURL, SyncAPI: syncAPIURL, OPDSBaseURL: opdsBaseURL.Value, diff --git a/internal/services/book_matching.go b/internal/services/book_matching.go index 30affc6..6f99537 100644 --- a/internal/services/book_matching.go +++ b/internal/services/book_matching.go @@ -60,7 +60,7 @@ func NewBookMatchingService(db *database.Queries) *BookMatchingService { func (s *BookMatchingService) QueryBooks(ctx context.Context, req *BookQueryRequest) (*BookQueryResponse, error) { var matches []BookMatch - // Priority 1: Bookmann UUID (canonical) - Confidence: 1.0 + // Priority 1: Bookhoard UUID (canonical) - Confidence: 1.0 if match := s.matchByBookhoardUUID(ctx, req.Identifiers); match != nil { matches = append(matches, *match) } @@ -113,7 +113,7 @@ func (s *BookMatchingService) QueryBooks(ctx context.Context, req *BookQueryRequ }, nil } -// matchByBookhoardUUID attempts to match by Bookmann UUID +// matchByBookhoardUUID attempts to match by Bookhoard UUID func (s *BookMatchingService) matchByBookhoardUUID(ctx context.Context, identifiers []string) *BookMatch { for _, id := range identifiers { if len(id) > 4 && id[:4] == "uuid:" { diff --git a/internal/services/book_matching_test.go b/internal/services/book_matching_test.go index 55a92c9..2cff14c 100644 --- a/internal/services/book_matching_test.go +++ b/internal/services/book_matching_test.go @@ -11,7 +11,7 @@ func TestBookMatchingService_QueryBooks(t *testing.T) { // This is a placeholder test that would need a mock database // For now, we'll test the matching priority logic structure - t.Run("Priority 1: Bookmann UUID match", func(t *testing.T) { + t.Run("Priority 1: Bookhoard UUID match", func(t *testing.T) { // Test that UUID matching returns highest confidence req := &BookQueryRequest{ Identifiers: []string{"uuid:550e8400-e29b-41d4-a716-446655440000"}, diff --git a/internal/sync/queue_test.go b/internal/sync/queue_test.go index cfec5bb..8982768 100644 --- a/internal/sync/queue_test.go +++ b/internal/sync/queue_test.go @@ -113,7 +113,7 @@ func TestPriorityConstants(t *testing.T) { func setupTestDB(t *testing.T) *database.Queries { ctx := context.Background() - dbURL := "postgresql://postgres:postgres@localhost:5432/bookmann?sslmode=disable" + dbURL := "postgresql://postgres:postgres@localhost:5432/bookhoard?sslmode=disable" dbPool, err := pgxpool.New(ctx, dbURL) require.NoError(t, err, "Failed to connect to test database")