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:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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:" {
|
||||
|
||||
@@ -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"},
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user