rc 1.0
This commit is contained in:
@@ -9,7 +9,7 @@ export async function GET(request: NextRequest) {
|
||||
)
|
||||
const drops = rows as any[]
|
||||
|
||||
// Calculate fill from sales for each drop
|
||||
// Calculate fill from sales for each drop and fetch images
|
||||
const dropsWithFill = await Promise.all(
|
||||
drops.map(async (drop) => {
|
||||
// Calculate fill from sales records
|
||||
@@ -27,9 +27,17 @@ export async function GET(request: NextRequest) {
|
||||
fill = totalFillInGrams / 1000
|
||||
}
|
||||
|
||||
// Fetch images for this drop
|
||||
const [imageRows] = await pool.execute(
|
||||
'SELECT image_url FROM drop_images WHERE drop_id = ? ORDER BY display_order ASC',
|
||||
[drop.id]
|
||||
)
|
||||
const images = (imageRows as any[]).map((row) => row.image_url)
|
||||
|
||||
return {
|
||||
...drop,
|
||||
fill: fill,
|
||||
images: images.length > 0 ? images : (drop.image_url ? [drop.image_url] : []),
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user