diff --git a/src/server/routes/pengaduan_route.ts b/src/server/routes/pengaduan_route.ts index 8bbaa60..847f091 100644 --- a/src/server/routes/pengaduan_route.ts +++ b/src/server/routes/pengaduan_route.ts @@ -1,5 +1,6 @@ import Elysia, { t } from "elysia" import type { StatusPengaduan } from "generated/prisma" +import _ from "lodash" import { v4 as uuidv4 } from "uuid" import { getLastUpdated } from "../lib/get-last-updated" import { mimeToExtension } from "../lib/mimetypeToExtension" @@ -332,7 +333,7 @@ const PengaduanRoute = new Elysia({ const dataHistory = await prisma.historyPengaduan.findMany({ where: { - idPengaduan: id, + idPengaduan: data?.id, }, select: { id: true, @@ -348,23 +349,20 @@ const PengaduanRoute = new Elysia({ } }) - const dataHistoryFix = dataHistory.map((item) => { - return { - id: item.id, - deskripsi: item.deskripsi, - status: item.status, - createdAt: item.createdAt.toLocaleString("id-ID", { - day: "2-digit", - month: "short", - year: "numeric", - hour: "2-digit", - minute: "2-digit", - hour12: false - }), - idUser: item.idUser, - nameUser: item.User?.name, - } - }) + + const dataHistoryFix = dataHistory.map((item: any) => ({ + ..._.omit(item, ["User", "createdAt"]), + nameUser: item.User?.name, + createdAt: item.createdAt.toLocaleString("id-ID", { + day: "2-digit", + month: "short", + year: "numeric", + hour: "2-digit", + minute: "2-digit", + hour12: false + }), + })) + const warga = { name: data?.Warga?.name,