This commit is contained in:
bipproduction
2025-11-21 14:23:56 +08:00
parent 54ae3b746d
commit eb1eaa11ea

View File

@@ -63,31 +63,27 @@ const TestPengaduanRoute = new Elysia({
const nomorHP = normalizePhoneNumber({ phone: noTelepon }) const nomorHP = normalizePhoneNumber({ phone: noTelepon })
const cariWarga = await prisma.warga.findUnique({ const cariWarga = await prisma.warga.upsert({
where: { where: {
phone: nomorHP, phone: nomorHP,
} },
}) create: {
name: "malik",
if (!cariWarga) { phone: nomorHP,
const wargaCreate = await prisma.warga.create({ },
data: { update: {
name: "malik", name: "malik",
phone: nomorHP, phone: nomorHP,
}, },
select: {
id: true
}
}) })
}
const pengaduan = await prisma.pengaduan.create({ const pengaduan = await prisma.pengaduan.create({
data: { data: {
title: judulPengaduan, title: judulPengaduan,
detail: detailPengaduan, detail: detailPengaduan,
idCategory: idCategoryFix, idCategory: idCategoryFix,
idWarga: "malik", idWarga: cariWarga.id,
location: lokasi, location: lokasi,
image: "", image: "",
noPengaduan, noPengaduan,