refactor(hash-conflicts): one usage-counts reader for the API and SSR surfaces
The pending-hash-conflict walk existed twice (JSON admin API emitting numeric counts, SSR page emitting a formatted summary) — deliberately different shapes, but both duplicated the counts-or-zero lookup and the five-field total. MediaItemUsageCountsTotal is the shared read; the per-surface shaping stays local on purpose.
This commit is contained in:
1 parent
010c0cb287
commit
2ba1e0960b
2 files changed
+17
-9
No files matched your search
@@ -1214,11 +1214,7 @@ func registerFrontendRoutes(cfg *Config) {
|
||||
}
|
||||
|
||||
for _, mi := range items {
|
||||
counts, err := cfg.Queries.GetMediaItemUsageCounts(c.Request().Context(), mi.ID)
|
||||
if err != nil {
|
||||
counts = database.GetMediaItemUsageCountsRow{}
|
||||
}
|
||||
totalData := counts.ProgressCount + counts.HighlightsCount + counts.BookmarksCount + counts.NotesCount + counts.CollectionsCount
|
||||
counts, totalData := handlers.MediaItemUsageCountsTotal(c.Request().Context(), cfg.Queries, mi.ID)
|
||||
conflict.Items = append(conflict.Items, templates.HashConflictItemData{
|
||||
ID: uuid.UUID(mi.ID.Bytes).String(),
|
||||
Title: mi.Title,
|
||||
|
||||
Reference in new issue
Block a user