Rename backend code references: Bookmann → Bookhoard
Backend changes: - Update import paths: bookmann/internal → bookhoard/internal - Rename struct fields: BookmannUUID → BookhoardUUID - Update handler function names: mapContentIdToBookmannUUID → mapContentIdToBookhoardUUID - Update HTTP response headers: X-Bookmann-* → X-Bookhoard-* - Update service and middleware references - Update main.go imports and references This is part 2 of the project rename to Bookhoard.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"bookmann/internal/database"
|
||||
"bookhoard/internal/database"
|
||||
"context"
|
||||
"fmt"
|
||||
"math"
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
// BookMatch represents a potential match with confidence score
|
||||
type BookMatch struct {
|
||||
MediaItemID uuid.UUID `json:"media_item_id"`
|
||||
BookmannUUID uuid.UUID `json:"bookmann_uuid"`
|
||||
BookhoardUUID uuid.UUID `json:"bookhoard_uuid"`
|
||||
Confidence float64 `json:"confidence"`
|
||||
MatchMethod string `json:"match_method"`
|
||||
}
|
||||
@@ -61,7 +61,7 @@ func (s *BookMatchingService) QueryBooks(ctx context.Context, req *BookQueryRequ
|
||||
var matches []BookMatch
|
||||
|
||||
// Priority 1: Bookmann UUID (canonical) - Confidence: 1.0
|
||||
if match := s.matchByBookmannUUID(ctx, req.Identifiers); match != nil {
|
||||
if match := s.matchByBookhoardUUID(ctx, req.Identifiers); match != nil {
|
||||
matches = append(matches, *match)
|
||||
}
|
||||
|
||||
@@ -113,8 +113,8 @@ func (s *BookMatchingService) QueryBooks(ctx context.Context, req *BookQueryRequ
|
||||
}, nil
|
||||
}
|
||||
|
||||
// matchByBookmannUUID attempts to match by Bookmann UUID
|
||||
func (s *BookMatchingService) matchByBookmannUUID(ctx context.Context, identifiers []string) *BookMatch {
|
||||
// matchByBookhoardUUID attempts to match by Bookmann UUID
|
||||
func (s *BookMatchingService) matchByBookhoardUUID(ctx context.Context, identifiers []string) *BookMatch {
|
||||
for _, id := range identifiers {
|
||||
if len(id) > 4 && id[:4] == "uuid:" {
|
||||
uuidStr := id[5:]
|
||||
@@ -129,7 +129,7 @@ func (s *BookMatchingService) matchByBookmannUUID(ctx context.Context, identifie
|
||||
mediaUUID := item.ID.Bytes
|
||||
return &BookMatch{
|
||||
MediaItemID: mediaUUID,
|
||||
BookmannUUID: mediaUUID,
|
||||
BookhoardUUID: mediaUUID,
|
||||
Confidence: 1.0,
|
||||
MatchMethod: "uuid_match",
|
||||
}
|
||||
@@ -156,7 +156,7 @@ func (s *BookMatchingService) matchByOPFUUID(ctx context.Context, identifiers []
|
||||
if item.OpfUuid.Valid && item.OpfUuid.String == uuidStr {
|
||||
return &BookMatch{
|
||||
MediaItemID: item.ID.Bytes,
|
||||
BookmannUUID: item.ID.Bytes,
|
||||
BookhoardUUID: item.ID.Bytes,
|
||||
Confidence: 0.95,
|
||||
MatchMethod: "opf_uuid_match",
|
||||
}
|
||||
@@ -181,7 +181,7 @@ func (s *BookMatchingService) matchBySHA256(ctx context.Context, sha256 string)
|
||||
if item.FileSha256.Valid && item.FileSha256.String == sha256 {
|
||||
return &BookMatch{
|
||||
MediaItemID: item.ID.Bytes,
|
||||
BookmannUUID: item.ID.Bytes,
|
||||
BookhoardUUID: item.ID.Bytes,
|
||||
Confidence: 0.9,
|
||||
MatchMethod: "sha256_match",
|
||||
}
|
||||
@@ -207,7 +207,7 @@ func (s *BookMatchingService) matchByOPFIdentifier(ctx context.Context, identifi
|
||||
if item.OpfIdentifier.Valid && item.OpfIdentifier.String == identifier {
|
||||
return &BookMatch{
|
||||
MediaItemID: item.ID.Bytes,
|
||||
BookmannUUID: item.ID.Bytes,
|
||||
BookhoardUUID: item.ID.Bytes,
|
||||
Confidence: 0.85,
|
||||
MatchMethod: "opf_identifier_match",
|
||||
}
|
||||
@@ -235,7 +235,7 @@ func (s *BookMatchingService) matchByISBNASIN(ctx context.Context, identifiers [
|
||||
if item.Isbn.Valid && item.Isbn.String == isbn {
|
||||
return &BookMatch{
|
||||
MediaItemID: item.ID.Bytes,
|
||||
BookmannUUID: item.ID.Bytes,
|
||||
BookhoardUUID: item.ID.Bytes,
|
||||
Confidence: 0.8,
|
||||
MatchMethod: "isbn_match",
|
||||
}
|
||||
@@ -257,7 +257,7 @@ func (s *BookMatchingService) matchByISBNASIN(ctx context.Context, identifiers [
|
||||
if item.Asin.Valid && item.Asin.String == asin {
|
||||
return &BookMatch{
|
||||
MediaItemID: item.ID.Bytes,
|
||||
BookmannUUID: item.ID.Bytes,
|
||||
BookhoardUUID: item.ID.Bytes,
|
||||
Confidence: 0.8,
|
||||
MatchMethod: "asin_match",
|
||||
}
|
||||
@@ -293,7 +293,7 @@ func (s *BookMatchingService) matchByTitleAuthorSize(ctx context.Context, title,
|
||||
if titleMatch && authorMatch && sizeMatch {
|
||||
matches = append(matches, BookMatch{
|
||||
MediaItemID: item.ID.Bytes,
|
||||
BookmannUUID: item.ID.Bytes,
|
||||
BookhoardUUID: item.ID.Bytes,
|
||||
Confidence: 0.5,
|
||||
MatchMethod: "title_author_size_match",
|
||||
})
|
||||
@@ -319,7 +319,7 @@ func (s *BookMatchingService) matchByTitleOnly(ctx context.Context, title string
|
||||
if item.Title == title {
|
||||
matches = append(matches, BookMatch{
|
||||
MediaItemID: item.ID.Bytes,
|
||||
BookmannUUID: item.ID.Bytes,
|
||||
BookhoardUUID: item.ID.Bytes,
|
||||
Confidence: 0.3,
|
||||
MatchMethod: "title_match",
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user