style: fix code alignment and indentation consistency

- Correct indentation in goroutine leak test setup block
- Align struct field tags in BookMatch and all matching methods for
  consistent column-style formatting (media_item_id, bookhoard_uuid,
  confidence, match_method)
- Improves code readability and adheres to project indentation guidelines
This commit is contained in:
2026-02-27 17:09:05 -05:00
parent b6ce478fe3
commit 6dd8e441d1
2 changed files with 28 additions and 28 deletions
+27 -27
View File
@@ -12,10 +12,10 @@ import (
// BookMatch represents a potential match with confidence score
type BookMatch struct {
MediaItemID uuid.UUID `json:"media_item_id"`
MediaItemID uuid.UUID `json:"media_item_id"`
BookhoardUUID uuid.UUID `json:"bookhoard_uuid"`
Confidence float64 `json:"confidence"`
MatchMethod string `json:"match_method"`
Confidence float64 `json:"confidence"`
MatchMethod string `json:"match_method"`
}
// BookQueryRequest represents a book query from a device
@@ -128,10 +128,10 @@ func (s *BookMatchingService) matchByBookhoardUUID(ctx context.Context, identifi
if err == nil {
mediaUUID := item.ID.Bytes
return &BookMatch{
MediaItemID: mediaUUID,
MediaItemID: mediaUUID,
BookhoardUUID: mediaUUID,
Confidence: 1.0,
MatchMethod: "uuid_match",
Confidence: 1.0,
MatchMethod: "uuid_match",
}
}
}
@@ -155,10 +155,10 @@ func (s *BookMatchingService) matchByOPFUUID(ctx context.Context, identifiers []
for _, item := range items {
if item.OpfUuid.Valid && item.OpfUuid.String == uuidStr {
return &BookMatch{
MediaItemID: item.ID.Bytes,
MediaItemID: item.ID.Bytes,
BookhoardUUID: item.ID.Bytes,
Confidence: 0.95,
MatchMethod: "opf_uuid_match",
Confidence: 0.95,
MatchMethod: "opf_uuid_match",
}
}
}
@@ -180,10 +180,10 @@ func (s *BookMatchingService) matchBySHA256(ctx context.Context, sha256 string)
for _, item := range items {
if item.FileSha256.Valid && item.FileSha256.String == sha256 {
return &BookMatch{
MediaItemID: item.ID.Bytes,
MediaItemID: item.ID.Bytes,
BookhoardUUID: item.ID.Bytes,
Confidence: 0.9,
MatchMethod: "sha256_match",
Confidence: 0.9,
MatchMethod: "sha256_match",
}
}
}
@@ -206,10 +206,10 @@ func (s *BookMatchingService) matchByOPFIdentifier(ctx context.Context, identifi
for _, item := range items {
if item.OpfIdentifier.Valid && item.OpfIdentifier.String == identifier {
return &BookMatch{
MediaItemID: item.ID.Bytes,
MediaItemID: item.ID.Bytes,
BookhoardUUID: item.ID.Bytes,
Confidence: 0.85,
MatchMethod: "opf_identifier_match",
Confidence: 0.85,
MatchMethod: "opf_identifier_match",
}
}
}
@@ -234,10 +234,10 @@ func (s *BookMatchingService) matchByISBNASIN(ctx context.Context, identifiers [
for _, item := range items {
if item.Isbn.Valid && item.Isbn.String == isbn {
return &BookMatch{
MediaItemID: item.ID.Bytes,
MediaItemID: item.ID.Bytes,
BookhoardUUID: item.ID.Bytes,
Confidence: 0.8,
MatchMethod: "isbn_match",
Confidence: 0.8,
MatchMethod: "isbn_match",
}
}
}
@@ -256,10 +256,10 @@ func (s *BookMatchingService) matchByISBNASIN(ctx context.Context, identifiers [
for _, item := range items {
if item.Asin.Valid && item.Asin.String == asin {
return &BookMatch{
MediaItemID: item.ID.Bytes,
MediaItemID: item.ID.Bytes,
BookhoardUUID: item.ID.Bytes,
Confidence: 0.8,
MatchMethod: "asin_match",
Confidence: 0.8,
MatchMethod: "asin_match",
}
}
}
@@ -292,10 +292,10 @@ func (s *BookMatchingService) matchByTitleAuthorSize(ctx context.Context, title,
if titleMatch && authorMatch && sizeMatch {
matches = append(matches, BookMatch{
MediaItemID: item.ID.Bytes,
MediaItemID: item.ID.Bytes,
BookhoardUUID: item.ID.Bytes,
Confidence: 0.5,
MatchMethod: "title_author_size_match",
Confidence: 0.5,
MatchMethod: "title_author_size_match",
})
}
}
@@ -318,10 +318,10 @@ func (s *BookMatchingService) matchByTitleOnly(ctx context.Context, title string
for _, item := range items {
if item.Title == title {
matches = append(matches, BookMatch{
MediaItemID: item.ID.Bytes,
MediaItemID: item.ID.Bytes,
BookhoardUUID: item.ID.Bytes,
Confidence: 0.3,
MatchMethod: "title_match",
Confidence: 0.3,
MatchMethod: "title_match",
})
}
}