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