Senin, 26 May 2025 :
Yang Sudah Di Kerjakan * Tampilan UI Admin di menu ekonomi * API Create, edit dan delete berita Yang Akan Dikerjakan: * API ProfilePPID * Tampilan UI Admin Di Menu Inovasi
This commit is contained in:
@@ -4,10 +4,15 @@ import beritaFindMany from "./find-many";
|
||||
import beritaCreate from "./create";
|
||||
import beritaDelete from "./del";
|
||||
import beritaUpdate from "./updt";
|
||||
import findBeritaById from "./find-by-id";
|
||||
|
||||
const Berita = new Elysia({ prefix: "/berita", tags: ["Desa/Berita"] })
|
||||
.get("/category/find-many", kategoriBeritaFindMany)
|
||||
.get("/find-many", beritaFindMany)
|
||||
.get("/:id", async (context) => {
|
||||
const response = await findBeritaById(new Request(context.request));
|
||||
return response;
|
||||
})
|
||||
.post("/create", beritaCreate, {
|
||||
body: t.Object({
|
||||
judul: t.String(),
|
||||
@@ -18,14 +23,21 @@ const Berita = new Elysia({ prefix: "/berita", tags: ["Desa/Berita"] })
|
||||
}),
|
||||
})
|
||||
.delete("/delete/:id", beritaDelete)
|
||||
.put("/update/:id", beritaUpdate, {
|
||||
body: t.Object({
|
||||
judul: t.String(),
|
||||
deskripsi: t.String(),
|
||||
imageId: t.String(),
|
||||
content: t.String(),
|
||||
kategoriBeritaId: t.Union([t.String(), t.Null()]),
|
||||
}),
|
||||
});
|
||||
.put(
|
||||
"/:id",
|
||||
async (context) => {
|
||||
const response = await beritaUpdate(context);
|
||||
return response;
|
||||
},
|
||||
{
|
||||
body: t.Object({
|
||||
judul: t.String(),
|
||||
deskripsi: t.String(),
|
||||
imageId: t.String(),
|
||||
content: t.String(),
|
||||
kategoriBeritaId: t.Union([t.String(), t.Null()]),
|
||||
}),
|
||||
}
|
||||
);
|
||||
|
||||
export default Berita;
|
||||
|
||||
Reference in New Issue
Block a user