UI Admin Menu Desa Sub Menu Profile
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import Elysia from "elysia";
|
||||
import Berita from "./berita";
|
||||
import Pengumuman from "./pengumuman";
|
||||
import ProfileDesa from "./profile/profile_desa";
|
||||
|
||||
const Desa = new Elysia({ prefix: "/api/desa", tags: ["Desa"] })
|
||||
.use(Berita)
|
||||
.use(Pengumuman)
|
||||
.use(ProfileDesa)
|
||||
|
||||
export default Desa;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import prisma from "@/lib/prisma";
|
||||
|
||||
export default async function profileDesaFindMany() {
|
||||
const res = await prisma.profileDesa.findMany({
|
||||
include: {
|
||||
ProfilPerbekel: true,
|
||||
},
|
||||
});
|
||||
return {
|
||||
data: res,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import Elysia, { t } from "elysia";
|
||||
import profileDesaFindMany from "./find-many";
|
||||
import lambangDesaUpdate from "./lambangDesa";
|
||||
import maskotDesaUpdate from "./maskotDesa";
|
||||
import profilePerbekelUpdate from "./profilePerbekel";
|
||||
import sejarahDesaUpdate from "./sejarahDesa";
|
||||
import visimisiDesaUpdate from "./visimisiDesa";
|
||||
|
||||
const ProfileDesa = new Elysia({
|
||||
prefix: "/profile",
|
||||
tags: ["Desa/Profile"]
|
||||
})
|
||||
.get("/find-many", profileDesaFindMany)
|
||||
.post("/profilePerbekel/update", profilePerbekelUpdate, {
|
||||
body: t.Object({
|
||||
id: t.String(),
|
||||
biodata: t.String(),
|
||||
pengalaman: t.String(),
|
||||
pengalamanOrganisasi: t.String(),
|
||||
programUnggulan: t.String(),
|
||||
})
|
||||
})
|
||||
.post("/visimisiDesa/update", visimisiDesaUpdate, {
|
||||
body: t.Object({
|
||||
id: t.String(),
|
||||
visi: t.String(),
|
||||
misi: t.String(),
|
||||
})
|
||||
})
|
||||
.post("/sejarahDesa/update", sejarahDesaUpdate, {
|
||||
body: t.Object({
|
||||
id: t.String(),
|
||||
sejarah: t.String(),
|
||||
})
|
||||
})
|
||||
.post("/lambangDesa/update", lambangDesaUpdate, {
|
||||
body: t.Object({
|
||||
id: t.String(),
|
||||
lambang: t.String(),
|
||||
})
|
||||
})
|
||||
.post("/maskotDesa/update", maskotDesaUpdate, {
|
||||
body: t.Object({
|
||||
id: t.String(),
|
||||
maskot: t.String(),
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
export default ProfileDesa
|
||||
@@ -0,0 +1,28 @@
|
||||
import prisma from "@/lib/prisma";
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { Context } from "elysia";
|
||||
|
||||
type FormCreate = Prisma.ProfileDesaGetPayload<{
|
||||
select: {
|
||||
id: true;
|
||||
lambang: true;
|
||||
}
|
||||
}>
|
||||
|
||||
export default async function lambangDesaUpdate(context: Context) {
|
||||
const body = context.body as FormCreate;
|
||||
|
||||
await prisma.profileDesa.update({
|
||||
where: {
|
||||
id: body.id
|
||||
},
|
||||
data: {
|
||||
lambang: body.lambang,
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: "Profile Desa Berhasil Diupdate",
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import prisma from "@/lib/prisma";
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { Context } from "elysia";
|
||||
|
||||
type FormCreate = Prisma.ProfileDesaGetPayload<{
|
||||
select: {
|
||||
id: true;
|
||||
maskot: true;
|
||||
}
|
||||
}>
|
||||
|
||||
export default async function maskotDesaUpdate(context: Context) {
|
||||
const body = context.body as FormCreate;
|
||||
|
||||
await prisma.profileDesa.update({
|
||||
where: {
|
||||
id: body.id
|
||||
},
|
||||
data: {
|
||||
maskot: body.maskot,
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: "Profile Desa Berhasil Diupdate",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import prisma from "@/lib/prisma";
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { Context } from "elysia";
|
||||
|
||||
type FormCreate = Prisma.ProfilPerbekelGetPayload<{
|
||||
select: {
|
||||
id: true;
|
||||
biodata: true;
|
||||
pengalaman: true;
|
||||
pengalamanOrganisasi: true;
|
||||
programUnggulan: true;
|
||||
}
|
||||
}>
|
||||
export default async function profilePerbekelUpdate(context: Context) {
|
||||
const body = context.body as FormCreate;
|
||||
|
||||
await prisma.profilPerbekel.update({
|
||||
where: {
|
||||
id: body.id
|
||||
},
|
||||
data: {
|
||||
biodata: body.biodata,
|
||||
pengalaman: body.pengalaman,
|
||||
pengalamanOrganisasi: body.pengalamanOrganisasi,
|
||||
programUnggulan: body.programUnggulan,
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: "Profile Perbekel Berhasil Diupdate",
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import prisma from "@/lib/prisma";
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { Context } from "elysia";
|
||||
|
||||
type FormCreate = Prisma.ProfileDesaGetPayload<{
|
||||
select: {
|
||||
id: true;
|
||||
sejarah: true;
|
||||
}
|
||||
}>
|
||||
|
||||
export default async function sejarahDesaUpdate(context: Context) {
|
||||
const body = context.body as FormCreate;
|
||||
|
||||
await prisma.profileDesa.update({
|
||||
where: {
|
||||
id: body.id
|
||||
},
|
||||
data: {
|
||||
sejarah: body.sejarah,
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: "Profile Desa Berhasil Diupdate",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import prisma from "@/lib/prisma";
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { Context } from "elysia";
|
||||
|
||||
type FormCreate = Prisma.ProfileDesaGetPayload<{
|
||||
select: {
|
||||
id: true;
|
||||
visi: true;
|
||||
misi: true;
|
||||
}
|
||||
}>
|
||||
export default async function visimisiDesaUpdate(context: Context) {
|
||||
const body = context.body as FormCreate;
|
||||
|
||||
await prisma.profileDesa.update({
|
||||
where: {
|
||||
id: body.id
|
||||
},
|
||||
data: {
|
||||
visi: body.visi,
|
||||
misi: body.misi,
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: "Profile Desa Berhasil Diupdate",
|
||||
}
|
||||
}
|
||||
@@ -11,9 +11,12 @@ type FormCreate = Prisma.DaftarInformasiPublikGetPayload<{
|
||||
}>
|
||||
export default async function daftarInformasiPublikCreate(context: Context) {
|
||||
const body = context.body as FormCreate;
|
||||
|
||||
const jumlahData = await prisma.daftarInformasiPublik.count({
|
||||
where: { isActive: true }, // hitung data aktif aja
|
||||
})
|
||||
await prisma.daftarInformasiPublik.create({
|
||||
data: {
|
||||
nomor: jumlahData + 1,
|
||||
jenisInformasi: body.jenisInformasi,
|
||||
deskripsi: body.deskripsi,
|
||||
tanggal: body.tanggal,
|
||||
|
||||
@@ -26,6 +26,7 @@ export default async function permohonanInformasiPublikCreate(context: Context)
|
||||
alamat: body.alamat,
|
||||
jenisInformasiDimintaId: body.jenisInformasiDimintaId,
|
||||
caraMemperolehInformasiId: body.caraMemperolehInformasiId,
|
||||
caraMemperolehSalinanInformasiId: body.caraMemperolehSalinanInformasiId,
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
import prisma from "@/lib/prisma";
|
||||
|
||||
export default async function permohonanInformasiPublikFindMany() {
|
||||
const res = await prisma.permohonanInformasiPublik.findMany();
|
||||
const res = await prisma.permohonanInformasiPublik.findMany({
|
||||
include: {
|
||||
jenisInformasiDiminta: true,
|
||||
caraMemperolehInformasi: true,
|
||||
caraMemperolehSalinanInformasi: true,
|
||||
}
|
||||
});
|
||||
return {
|
||||
data: res,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user