upd : dahboard admin
Deskripsi: - detail pengaduan No Issues
This commit is contained in:
@@ -28,8 +28,8 @@ const PengaduanRoute = new Elysia({
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
return {data}
|
||||
|
||||
return { data }
|
||||
}, {
|
||||
detail: {
|
||||
summary: "List Kategori Pengaduan",
|
||||
@@ -316,12 +316,14 @@ Respon:
|
||||
})
|
||||
.get("/detail", async ({ query }) => {
|
||||
const { id } = query
|
||||
const data = await prisma.pengaduan.findUnique({
|
||||
|
||||
const data = await prisma.pengaduan.findFirst({
|
||||
where: {
|
||||
id,
|
||||
OR: [
|
||||
{
|
||||
noPengaduan: id
|
||||
}, {
|
||||
id: id
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -346,6 +348,13 @@ Respon:
|
||||
Warga: {
|
||||
select: {
|
||||
name: true,
|
||||
phone: true,
|
||||
_count: {
|
||||
select: {
|
||||
Pengaduan: true,
|
||||
PelayananAjuan: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -374,27 +383,37 @@ Respon:
|
||||
id: item.id,
|
||||
deskripsi: item.deskripsi,
|
||||
status: item.status,
|
||||
createdAt: item.createdAt,
|
||||
createdAt: item.createdAt.toLocaleDateString("id-ID", { day: "numeric", month: "long", year: "numeric" }),
|
||||
idUser: item.idUser,
|
||||
nameUser: item.User?.name,
|
||||
}
|
||||
})
|
||||
|
||||
const datafix = {
|
||||
const warga = {
|
||||
name: data?.Warga?.name,
|
||||
phone: data?.Warga?.phone,
|
||||
pengaduan: data?.Warga?._count.Pengaduan,
|
||||
pelayanan: data?.Warga?._count.PelayananAjuan,
|
||||
}
|
||||
|
||||
const dataPengaduan = {
|
||||
id: data?.id,
|
||||
noPengaduan: data?.noPengaduan,
|
||||
title: data?.title,
|
||||
detail: data?.detail,
|
||||
location: data?.location,
|
||||
image: data?.image,
|
||||
CategoryPengaduan: data?.CategoryPengaduan.name,
|
||||
idWarga: data?.idWarga,
|
||||
nameWarga: data?.Warga?.name,
|
||||
category: data?.CategoryPengaduan.name,
|
||||
status: data?.status,
|
||||
keterangan: data?.keterangan,
|
||||
createdAt: data?.createdAt,
|
||||
updatedAt: data?.updatedAt,
|
||||
}
|
||||
|
||||
const datafix = {
|
||||
pengaduan: dataPengaduan,
|
||||
history: dataHistoryFix,
|
||||
warga: warga,
|
||||
}
|
||||
|
||||
return datafix
|
||||
|
||||
Reference in New Issue
Block a user