upd: api detail pengaduan jenna ai

This commit is contained in:
2025-11-26 14:29:00 +08:00
parent decf6dd972
commit d7e77da16a

View File

@@ -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,