This commit is contained in:
@@ -90,7 +90,9 @@ export async function DELETE(
|
||||
const fund = await prisma.hedgeFund.findUnique({ where: { id: params.fundId } })
|
||||
if (!fund) return NextResponse.json({ error: 'Fund not found.' }, { status: 404 })
|
||||
|
||||
// Delete shadow user cascades positions, trades, and the fund record
|
||||
// Must delete fund first (it holds the FK to User), then delete the shadow user
|
||||
// (which cascades positions and trades).
|
||||
await prisma.hedgeFund.delete({ where: { id: fund.id } })
|
||||
await prisma.user.delete({ where: { id: fund.userId } })
|
||||
|
||||
return NextResponse.json({ ok: true })
|
||||
|
||||
Reference in New Issue
Block a user