mirror of
https://github.com/jorgev259/soc_site-astro.git
synced 2025-06-29 07:57:41 +00:00
This commit is contained in:
parent
63affb6b7f
commit
60a3ef3541
4 changed files with 18 additions and 8 deletions
|
|
@ -53,6 +53,7 @@ export const POST: APIRoute = async ({ request, locals }) => {
|
|||
platforms: { create: body.platforms.map((id) => ({ platform: { connect: { id } } })) },
|
||||
// albumHistories
|
||||
discs: { createMany: { data: body.discs } },
|
||||
stores: { createMany: { data: body.stores } },
|
||||
relatedAlbums: { create: body.related.map((id) => ({ relatedAlbum: { connect: { id } } })) }
|
||||
},
|
||||
include: { artists: { include: { artist: { select: { name: true } } } } }
|
||||
|
|
|
|||
|
|
@ -60,7 +60,8 @@ export const POST: APIRoute = async ({ request, locals }) => {
|
|||
platforms: { deleteMany: {}, create: platforms?.map((id) => ({ platform: { connect: { id } } })) },
|
||||
discs: { deleteMany: {}, createMany: { data: body.discs ?? [] } },
|
||||
relatedAlbums: { deleteMany: {}, create: related?.map((id) => ({ relatedAlbum: { connect: { id } } })) },
|
||||
downloads: { deleteMany: {} }
|
||||
downloads: { deleteMany: {} },
|
||||
stores: stores ? { deleteMany: {}, createMany: { data: stores } } : undefined
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue