Final cleanup: Update remaining comments and variable names

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.
This commit is contained in:
2026-02-01 16:24:58 -05:00
parent 6d9b36be82
commit 5b9f21a592
8 changed files with 20 additions and 20 deletions
+4 -4
View File
@@ -113,14 +113,14 @@ AutoSyncEnabled=true
SyncFrequency=5 SyncFrequency=5
# Authentication # Authentication
Username=YOUR_BOOKMANN_USERNAME Username=YOUR_BOOKHOARD_USERNAME
Password=YOUR_BOOKMANN_PASSWORD Password=YOUR_BOOKHOARD_PASSWORD
``` ```
**Replace the following with your actual values**: **Replace the following with your actual values**:
- `YOUR_COMPUTER_IP`: Your computer's local IP address (e.g., 192.168.1.100) - `YOUR_COMPUTER_IP`: Your computer's local IP address (e.g., 192.168.1.100)
- `YOUR_BOOKMANN_USERNAME`: Your Bookhoard email or username - `YOUR_BOOKHOARD_USERNAME`: Your Bookhoard email or username
- `YOUR_BOOKMANN_PASSWORD`: Your Bookhoard password - `YOUR_BOOKHOARD_PASSWORD`: Your Bookhoard password
**Example configuration:** **Example configuration:**
```ini ```ini
+1 -1
View File
@@ -130,7 +130,7 @@ type Querier interface {
GetDevice(ctx context.Context, id pgtype.UUID) (Devices, error) GetDevice(ctx context.Context, id pgtype.UUID) (Devices, error)
GetDeviceByAuthToken(ctx context.Context, authToken string) (Devices, error) GetDeviceByAuthToken(ctx context.Context, authToken string) (Devices, error)
GetDeviceByIdentifier(ctx context.Context, deviceIdentifier 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) GetDeviceCatalogByBookhoardUUID(ctx context.Context, arg GetDeviceCatalogByBookhoardUUIDParams) (DeviceCatalogs, error)
// Get device catalog by Kobo ContentId // Get device catalog by Kobo ContentId
GetDeviceCatalogByKoboContentId(ctx context.Context, koboContentID string) (DeviceCatalogs, error) GetDeviceCatalogByKoboContentId(ctx context.Context, koboContentID string) (DeviceCatalogs, error)
+1 -1
View File
@@ -1828,7 +1828,7 @@ type GetDeviceCatalogByBookhoardUUIDParams struct {
BookmannUuid pgtype.UUID `db:"bookhoard_uuid" json:"bookhoard_uuid"` 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) { func (q *Queries) GetDeviceCatalogByBookhoardUUID(ctx context.Context, arg GetDeviceCatalogByBookhoardUUIDParams) (DeviceCatalogs, error) {
row := q.db.QueryRow(ctx, GetDeviceCatalogByBookhoardUUID, arg.DeviceID, arg.BookmannUuid) row := q.db.QueryRow(ctx, GetDeviceCatalogByBookhoardUUID, arg.DeviceID, arg.BookmannUuid)
var i DeviceCatalogs var i DeviceCatalogs
+3 -3
View File
@@ -25,13 +25,13 @@ func NewKoboHandler(db *database.Queries, connManager *wsync.ConnectionManager)
return &KoboHandler{db: db, connManager: connManager} 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 // Phase 6: Enhanced Kobo Sync - ContentId Mapping Logic
func (h *KoboHandler) mapContentIdToBookhoardUUID(ctx echo.Context, contentId string, deviceID uuid.UUID) (uuid.UUID, error, string) { 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 // Step 1: Try direct ContentId lookup in device_catalogs table
catalog, err := h.db.GetDeviceCatalogByKoboContentId(ctx.Request().Context(), contentId) catalog, err := h.db.GetDeviceCatalogByKoboContentId(ctx.Request().Context(), contentId)
if err == nil && catalog.ID.Valid { 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" 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" 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 // Creates new entry in device_catalogs if not exists
func (h *KoboHandler) mapBookhoardUUIDToKoboContentId(c echo.Context, bookmannUUID uuid.UUID, deviceID uuid.UUID) (string, error) { func (h *KoboHandler) mapBookhoardUUIDToKoboContentId(c echo.Context, bookmannUUID uuid.UUID, deviceID uuid.UUID) (string, error) {
// Check if catalog entry already exists // Check if catalog entry already exists
+7 -7
View File
@@ -22,7 +22,7 @@ func NewSidecarHandler(db *database.Queries) *SidecarHandler {
type SidecarConfig struct { type SidecarConfig struct {
Version string `json:"version"` Version string `json:"version"`
Bookmann SidecarBookmannConfig `json:"bookhoard"` Bookhoard SidecarBookhoardConfig `json:"bookhoard"`
Books map[string]SidecarBook `json:"books"` Books map[string]SidecarBook `json:"books"`
Collections []SidecarCollection `json:"collections"` Collections []SidecarCollection `json:"collections"`
OPDSEnabled bool `json:"opds_enabled"` OPDSEnabled bool `json:"opds_enabled"`
@@ -30,7 +30,7 @@ type SidecarConfig struct {
LastUpdated string `json:"last_updated"` LastUpdated string `json:"last_updated"`
} }
type SidecarBookmannConfig struct { type SidecarBookhoardConfig struct {
OPDSCatalog string `json:"opds_catalog"` OPDSCatalog string `json:"opds_catalog"`
SyncAPI string `json:"sync_api"` SyncAPI string `json:"sync_api"`
OPDSBaseURL string `json:"opds_base_url"` OPDSBaseURL string `json:"opds_base_url"`
@@ -40,7 +40,7 @@ type SidecarBookmannConfig struct {
} }
type SidecarBook struct { type SidecarBook struct {
BookhoardUUID string `json:"bookhoard_uuid"` BookhoardUUID string `json:"bookhoard_uuid"`
Title string `json:"title"` Title string `json:"title"`
Author string `json:"author"` Author string `json:"author"`
AvailableFormats []string `json:"available_formats"` AvailableFormats []string `json:"available_formats"`
@@ -119,7 +119,7 @@ func (h *SidecarHandler) GetSidecarConfig(c echo.Context) error {
} }
books[key] = SidecarBook{ books[key] = SidecarBook{
BookhoardUUID: bookUUID, BookhoardUUID: bookUUID,
Title: item.Title, Title: item.Title,
Author: author, Author: author,
AvailableFormats: availableFormats, AvailableFormats: availableFormats,
@@ -169,7 +169,7 @@ func (h *SidecarHandler) GetSidecarConfig(c echo.Context) error {
// Build sidecar config // Build sidecar config
config := SidecarConfig{ config := SidecarConfig{
Version: "1.0", Version: "1.0",
Bookmann: SidecarBookmannConfig{ Bookhoard: SidecarBookhoardConfig{
OPDSCatalog: opdsCatalogURL, OPDSCatalog: opdsCatalogURL,
SyncAPI: syncAPIURL, SyncAPI: syncAPIURL,
OPDSBaseURL: opdsBaseURL.Value, OPDSBaseURL: opdsBaseURL.Value,
@@ -254,7 +254,7 @@ func (h *SidecarHandler) DownloadSidecarConfig(c echo.Context) error {
} }
books[key] = SidecarBook{ books[key] = SidecarBook{
BookhoardUUID: bookUUID, BookhoardUUID: bookUUID,
Title: item.Title, Title: item.Title,
Author: author, Author: author,
AvailableFormats: availableFormats, AvailableFormats: availableFormats,
@@ -300,7 +300,7 @@ func (h *SidecarHandler) DownloadSidecarConfig(c echo.Context) error {
sidecarConfig = SidecarConfig{ sidecarConfig = SidecarConfig{
Version: "1.0", Version: "1.0",
Bookmann: SidecarBookmannConfig{ Bookhoard: SidecarBookhoardConfig{
OPDSCatalog: opdsCatalogURL, OPDSCatalog: opdsCatalogURL,
SyncAPI: syncAPIURL, SyncAPI: syncAPIURL,
OPDSBaseURL: opdsBaseURL.Value, OPDSBaseURL: opdsBaseURL.Value,
+2 -2
View File
@@ -60,7 +60,7 @@ func NewBookMatchingService(db *database.Queries) *BookMatchingService {
func (s *BookMatchingService) QueryBooks(ctx context.Context, req *BookQueryRequest) (*BookQueryResponse, error) { func (s *BookMatchingService) QueryBooks(ctx context.Context, req *BookQueryRequest) (*BookQueryResponse, error) {
var matches []BookMatch 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 { if match := s.matchByBookhoardUUID(ctx, req.Identifiers); match != nil {
matches = append(matches, *match) matches = append(matches, *match)
} }
@@ -113,7 +113,7 @@ func (s *BookMatchingService) QueryBooks(ctx context.Context, req *BookQueryRequ
}, nil }, 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 { func (s *BookMatchingService) matchByBookhoardUUID(ctx context.Context, identifiers []string) *BookMatch {
for _, id := range identifiers { for _, id := range identifiers {
if len(id) > 4 && id[:4] == "uuid:" { if len(id) > 4 && id[:4] == "uuid:" {
+1 -1
View File
@@ -11,7 +11,7 @@ func TestBookMatchingService_QueryBooks(t *testing.T) {
// This is a placeholder test that would need a mock database // This is a placeholder test that would need a mock database
// For now, we'll test the matching priority logic structure // 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 // Test that UUID matching returns highest confidence
req := &BookQueryRequest{ req := &BookQueryRequest{
Identifiers: []string{"uuid:550e8400-e29b-41d4-a716-446655440000"}, Identifiers: []string{"uuid:550e8400-e29b-41d4-a716-446655440000"},
+1 -1
View File
@@ -113,7 +113,7 @@ func TestPriorityConstants(t *testing.T) {
func setupTestDB(t *testing.T) *database.Queries { func setupTestDB(t *testing.T) *database.Queries {
ctx := context.Background() 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) dbPool, err := pgxpool.New(ctx, dbURL)
require.NoError(t, err, "Failed to connect to test database") require.NoError(t, err, "Failed to connect to test database")