From c7d9605d8129c2cec2b28b4d8362ff16e5e093ec Mon Sep 17 00:00:00 2001 From: Jorge Vargas Date: Sun, 6 Apr 2025 19:17:12 -0600 Subject: [PATCH] Fix download link creation in album edit --- src/pages/api/album/edit.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/pages/api/album/edit.ts b/src/pages/api/album/edit.ts index b168d82..5927808 100644 --- a/src/pages/api/album/edit.ts +++ b/src/pages/api/album/edit.ts @@ -66,13 +66,17 @@ export const POST: APIRoute = async ({ request, locals }) => { await Promise.all([ cover ? handleCover(cover, 'album', albumId, tx) : undefined, downloads - ? tx.downloads.createMany({ - data: downloads.map((d) => ({ - title: d.title, - albumId: albumId, - links: { create: d.links } - })) - }) + ? Promise.all( + downloads.map((d) => + tx.downloads.create({ + data: { + title: d.title, + albumId: albumId, + links: { create: d.links } + } + }) + ) + ) : undefined ]) })