Menu Desa, Sub Menu Yang Tersisa Tinga Tinggal Profile Aja
This commit is contained in:
32
src/app/api/[[...slugs]]/_lib/desa/penghargaan/create.ts
Normal file
32
src/app/api/[[...slugs]]/_lib/desa/penghargaan/create.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import prisma from "@/lib/prisma";
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { Context } from "elysia";
|
||||
|
||||
type FormCreate = Prisma.PenghargaanGetPayload<{
|
||||
select: {
|
||||
juara: true;
|
||||
name: true;
|
||||
deskripsi: true;
|
||||
imageId: true;
|
||||
}
|
||||
}>
|
||||
export default async function penghargaanCreate(context: Context){
|
||||
const body = context.body as FormCreate;
|
||||
|
||||
await prisma.penghargaan.create({
|
||||
data: {
|
||||
juara: body.juara,
|
||||
name: body.name,
|
||||
deskripsi: body.deskripsi,
|
||||
imageId: body.imageId,
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: "Success create penghargaan",
|
||||
data: {
|
||||
...body,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user