feat(media): unify uploads onto modules/album, add batched srcset enrichment and Media Library picker

This commit is contained in:
Jakub Zych
2026-11-27 13:26:59 +01:00
parent f61c90a326
commit ccd8dc85aa
14 changed files with 781 additions and 79 deletions

View File

@@ -202,8 +202,15 @@ func AuthorPosts(app *backpack.App) http.HandlerFunc {
return
}
rows := make([]map[string]any, 0, len(posts))
postPtrs := make([]*models.Post, len(posts))
trs := make([]any, len(posts))
for i := range posts {
rows = append(rows, serializePost(&posts[i], db))
postPtrs[i] = &posts[i]
trs[i] = translationsOf(db, &posts[i])
}
media := batchLoadPostMedia(r.Context(), db, app, postPtrs, trs)
for i := range posts {
rows = append(rows, serializePostWithMedia(&posts[i], db, trs[i], media))
}
wire.WriteJSON(w, http.StatusOK, lagoon.Paginate(rows, page, perPage, total))
}