fix: refactor user creation to store user in a variable before trade creation
Build Images and Deploy / Update-PROD-Stack (push) Successful in 1m26s

This commit is contained in:
2026-03-20 12:49:12 -04:00
parent ea1dca974c
commit c28720be5a
+12 -1
View File
@@ -36,9 +36,20 @@ export async function POST(req: NextRequest) {
const passwordHash = await bcrypt.hash(password, 12) const passwordHash = await bcrypt.hash(password, 12)
await prisma.user.create({ const user = await prisma.user.create({
data: { username, displayUsername, passwordHash }, data: { username, displayUsername, passwordHash },
}) })
await prisma.trade.create({
data: {
userId: user.id,
type: 'ACCOUNT_OPEN',
shares: 0,
price: 0,
total: 2000,
profit: 2000,
},
})
return NextResponse.json({ ok: true }, { status: 201 }) return NextResponse.json({ ok: true }, { status: 201 })
} }