upd: dashboard admin

Deskripsi:
- pagination list pengaduan

No Issues
This commit is contained in:
2025-12-02 11:22:05 +08:00
parent 4996da4189
commit cc7c8eb704
2 changed files with 60 additions and 36 deletions

View File

@@ -646,6 +646,10 @@ const PengaduanRoute = new Elysia({
}
}
const totalData = await prisma.pengaduan.count({
where
});
const data = await prisma.pengaduan.findMany({
skip,
take: !take ? 10 : Number(take),
@@ -683,12 +687,20 @@ const PengaduanRoute = new Elysia({
detail: item.detail,
status: item.status,
location: item.location,
createdAt: item.createdAt.toLocaleDateString("id-ID", { day: "numeric", month: "long", year: "numeric" }),
createdAt: item.createdAt,
updatedAt: 'terakhir diperbarui ' + getLastUpdated(item.updatedAt),
}
})
return dataFix
const dataReturn = {
data: dataFix,
total: totalData,
page: Number(page) || 1,
pageSize: !take ? 10 : Number(take),
totalPages: Math.ceil(totalData / (!take ? 10 : Number(take)))
}
return dataReturn
}, {
query: t.Object({
take: t.String({ optional: true }),
@@ -790,8 +802,6 @@ const PengaduanRoute = new Elysia({
description: "Tool untuk delete file Seafile",
},
})
;
export default PengaduanRoute