fix: removed api
This commit is contained in:
parent
9df430fa72
commit
80ef4007f7
|
@ -7,12 +7,5 @@ interface IBody {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function POST(req: Request){
|
export async function POST(req: Request){
|
||||||
const body = await req.json() as IBody
|
|
||||||
const grade = await prisma.grade.findFirst({ select: { id: true}, where: { oral: 1, key: { key: body.key } } });
|
|
||||||
if(grade) return NextResponse.json({message: 'Deja vote'}, {status: 403});
|
|
||||||
|
|
||||||
const gradeCreated = await prisma.grade.create({ data: { key: { connect: { key: body.key } }, grade: body.grade, oral: 1 } });
|
|
||||||
if(gradeCreated) return NextResponse.json({message: 'Vote enregistré'}, {status: 200});
|
|
||||||
|
|
||||||
return NextResponse.json({message: 'Server error'}, {status: 500})
|
return NextResponse.json({message: 'Server error'}, {status: 500})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue