feat(series): add SeriesService and wire continue-series into dashboard
Create SeriesService with methods for paginated series listing, cover path resolution, series book listing, and a conversion helper for GetContinueSeriesItemsRow to MediaItems. Wire the continue-series query type into DashboardService's getCollectionItemsByQueryType switch and add its metadata to the RestoreSystemCollection default collection map.
This commit is contained in:
@@ -292,6 +292,20 @@ func (s *DashboardService) getCollectionItemsByQueryType(ctx context.Context, co
|
||||
LibraryID: pgtype.UUID{Bytes: libraryID, Valid: true},
|
||||
Limit: int32(limit),
|
||||
})
|
||||
case "continue-series":
|
||||
rows, err := s.db.GetContinueSeriesItems(ctx, database.GetContinueSeriesItemsParams{
|
||||
LibraryID: pgtype.UUID{Bytes: libraryID, Valid: true},
|
||||
UserID: pgtype.UUID{Bytes: userID, Valid: true},
|
||||
Limit: int32(limit),
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items := make([]database.MediaItems, 0, len(rows))
|
||||
for _, row := range rows {
|
||||
items = append(items, continueSeriesRowToMediaItems(row))
|
||||
}
|
||||
return items, nil
|
||||
default:
|
||||
return []database.MediaItems{}, nil
|
||||
}
|
||||
@@ -407,6 +421,7 @@ func (s *DashboardService) RestoreSystemCollection(ctx context.Context, userID u
|
||||
"Recently Added": {"Newly added items to this library", "🆕", "#9ece6a", 2, "recently-added"},
|
||||
"Recently Read": {"Books you've finished (progress >= 1)", "✅", "#e0af68", 3, "recently-read"},
|
||||
"Not Started": {"Books you haven't read yet (progress = 0 or no record)", "📕", "#f7768e", 4, "not-started"},
|
||||
"Continue Series": {"Next book in series you're reading", "📚", "#bb9af7", 5, "continue-series"},
|
||||
}
|
||||
|
||||
meta, exists := defaultMetadata[collectionName]
|
||||
|
||||
Reference in New Issue
Block a user