Compare commits
4 Commits
amalia/02-
...
amalia/06-
| Author | SHA1 | Date | |
|---|---|---|---|
| 7e80a1f311 | |||
| b648735b06 | |||
| a3d8bf1e92 | |||
| c2c52ed5fd |
@@ -255,15 +255,20 @@ export async function POST(request: Request) {
|
|||||||
|
|
||||||
|
|
||||||
const dataNotifFilter = dataNotif.filter((v: any) => v.idUserTo != undefined && v.idUserTo != null && v.idUserTo != "" && v.idUserTo != userId)
|
const dataNotifFilter = dataNotif.filter((v: any) => v.idUserTo != undefined && v.idUserTo != null && v.idUserTo != "" && v.idUserTo != userId)
|
||||||
|
const dataNotifFilterUnique = dataNotifFilter
|
||||||
|
.filter((v: any, index: number, self: any[]) =>
|
||||||
|
index === self.findIndex((t: any) => t.idUserTo == v.idUserTo)
|
||||||
|
)
|
||||||
|
|
||||||
const pushNotif = dataPush.filter((item) => item.subscription != undefined)
|
const pushNotif = dataPush.filter((item) => item.subscription != undefined)
|
||||||
|
|
||||||
const sendWebPush = await funSendWebPush({ sub: pushNotif, message: { title: 'Pengumuman Baru', body: title } })
|
const sendWebPush = await funSendWebPush({ sub: pushNotif, message: { title: 'Pengumuman Baru', body: title } })
|
||||||
const insertNotif = await prisma.notifications.createMany({
|
const insertNotif = await prisma.notifications.createMany({
|
||||||
data: dataNotifFilter
|
data: dataNotifFilterUnique
|
||||||
})
|
})
|
||||||
|
|
||||||
const tokenUnique = [...new Set(tokenDup.flat())].filter((v: any) => v != undefined && v != null && v != "");
|
const tokenUnique = [...new Set(tokenDup.flat())].filter((v: any) => v != undefined && v != null && v != "");
|
||||||
|
|
||||||
await sendFCMNotificationMany({
|
await sendFCMNotificationMany({
|
||||||
token: tokenUnique,
|
token: tokenUnique,
|
||||||
title: "Pengumuman Baru",
|
title: "Pengumuman Baru",
|
||||||
|
|||||||
@@ -210,9 +210,13 @@ export async function POST(request: Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dataNotif.filter((v: any) => v.idUserTo != undefined && v.idUserTo != null && v.idUserTo != "" && v.idUserTo != userId)
|
dataNotif.filter((v: any) => v.idUserTo != undefined && v.idUserTo != null && v.idUserTo != "" && v.idUserTo != userId)
|
||||||
|
const dataNotifUnique = dataNotif
|
||||||
|
.filter((v: any, index: number, self: any[]) =>
|
||||||
|
index === self.findIndex((t: any) => t.idUserTo == v.idUserTo)
|
||||||
|
)
|
||||||
|
|
||||||
const insertNotif = await prisma.notifications.createMany({
|
const insertNotif = await prisma.notifications.createMany({
|
||||||
data: dataNotif
|
data: dataNotifUnique
|
||||||
})
|
})
|
||||||
|
|
||||||
const tokenUnique = [...new Set(tokenDup.flat())].filter((v: any) => v != undefined && v != null && v != "");
|
const tokenUnique = [...new Set(tokenDup.flat())].filter((v: any) => v != undefined && v != null && v != "");
|
||||||
|
|||||||
@@ -263,12 +263,16 @@ export async function POST(request: Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const dataNotifFilter = dataNotif.filter((v: any) => v.idUserTo != undefined && v.idUserTo != null && v.idUserTo != "" && v.idUserTo != userId)
|
const dataNotifFilter = dataNotif.filter((v: any) => v.idUserTo != undefined && v.idUserTo != null && v.idUserTo != "" && v.idUserTo != userId)
|
||||||
|
const dataNotifFilterUnique = dataNotifFilter
|
||||||
|
.filter((v: any, index: number, self: any[]) =>
|
||||||
|
index === self.findIndex((t: any) => t.idUserTo == v.idUserTo)
|
||||||
|
)
|
||||||
|
|
||||||
const pushNotif = dataPush.filter((item) => item.subscription != undefined)
|
const pushNotif = dataPush.filter((item) => item.subscription != undefined)
|
||||||
|
|
||||||
const sendWebPush = await funSendWebPush({ sub: pushNotif, message: { body: deskripsiNotif, title: 'Diskusi Baru' } })
|
const sendWebPush = await funSendWebPush({ sub: pushNotif, message: { body: deskripsiNotif, title: 'Diskusi Baru' } })
|
||||||
const insertNotif = await prisma.notifications.createMany({
|
const insertNotif = await prisma.notifications.createMany({
|
||||||
data: dataNotifFilter
|
data: dataNotifFilterUnique
|
||||||
})
|
})
|
||||||
|
|
||||||
const tokenUnique = [...new Set(tokenDup.flat())].filter((v: any) => v != undefined && v != null && v != "");
|
const tokenUnique = [...new Set(tokenDup.flat())].filter((v: any) => v != undefined && v != null && v != "");
|
||||||
|
|||||||
@@ -314,12 +314,16 @@ export async function POST(request: Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const dataNotifFilter = dataNotif.filter((v: any) => v.idUserTo != undefined && v.idUserTo != null && v.idUserTo != "" && v.idUserTo != userId)
|
const dataNotifFilter = dataNotif.filter((v: any) => v.idUserTo != undefined && v.idUserTo != null && v.idUserTo != "" && v.idUserTo != userId)
|
||||||
|
const dataNotifFilterUnique = dataNotifFilter
|
||||||
|
.filter((v: any, index: number, self: any[]) =>
|
||||||
|
index === self.findIndex((t: any) => t.idUserTo == v.idUserTo)
|
||||||
|
)
|
||||||
|
|
||||||
const pushNotif = dataPush.filter((item) => item.subscription != undefined)
|
const pushNotif = dataPush.filter((item) => item.subscription != undefined)
|
||||||
|
|
||||||
const sendWebPush = await funSendWebPush({ sub: pushNotif, message: { title: 'Divisi Baru', body: `Divisi ${sent.data.name} telah dibuat. Silakan periksa detailnya.` } })
|
const sendWebPush = await funSendWebPush({ sub: pushNotif, message: { title: 'Divisi Baru', body: `Divisi ${sent.data.name} telah dibuat. Silakan periksa detailnya.` } })
|
||||||
const insertNotif = await prisma.notifications.createMany({
|
const insertNotif = await prisma.notifications.createMany({
|
||||||
data: dataNotifFilter
|
data: dataNotifFilterUnique
|
||||||
})
|
})
|
||||||
|
|
||||||
const tokenUnique = [...new Set(tokenDup.flat())].filter((v: any) => v != undefined && v != null && v != "");
|
const tokenUnique = [...new Set(tokenDup.flat())].filter((v: any) => v != undefined && v != null && v != "");
|
||||||
|
|||||||
@@ -425,19 +425,19 @@ export async function GET(request: Request) {
|
|||||||
isActive: true,
|
isActive: true,
|
||||||
status: 1,
|
status: 1,
|
||||||
idVillage: idVillage
|
idVillage: idVillage
|
||||||
},
|
}
|
||||||
|
|
||||||
kondisi = {
|
kondisi = {
|
||||||
|
isActive: true,
|
||||||
|
status: 1,
|
||||||
|
Division: {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
status: 1,
|
idVillage: idVillage,
|
||||||
Division: {
|
Group: {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
idVillage: idVillage,
|
|
||||||
Group: {
|
|
||||||
isActive: true,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
kondisiUmum = {
|
kondisiUmum = {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
|
|||||||
@@ -385,11 +385,15 @@ export async function POST(request: Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const dataNotifFilter = dataNotif.filter((item) => item.idUserTo != undefined && item.idUserTo != null && item.idUserTo != "" && item.idUserTo != userId)
|
const dataNotifFilter = dataNotif.filter((item) => item.idUserTo != undefined && item.idUserTo != null && item.idUserTo != "" && item.idUserTo != userId)
|
||||||
|
const dataNotifFilterUnique = dataNotifFilter
|
||||||
|
.filter((v: any, index: number, self: any[]) =>
|
||||||
|
index === self.findIndex((t: any) => t.idUserTo == v.idUserTo)
|
||||||
|
)
|
||||||
const pushNotif = dataPush.filter((item) => item.subscription != undefined)
|
const pushNotif = dataPush.filter((item) => item.subscription != undefined)
|
||||||
|
|
||||||
const sendWebPush = await funSendWebPush({ sub: pushNotif, message: { title: 'Kegiatan Baru', body: title } })
|
const sendWebPush = await funSendWebPush({ sub: pushNotif, message: { title: 'Kegiatan Baru', body: title } })
|
||||||
const insertNotif = await prisma.notifications.createMany({
|
const insertNotif = await prisma.notifications.createMany({
|
||||||
data: dataNotifFilter
|
data: dataNotifFilterUnique
|
||||||
})
|
})
|
||||||
|
|
||||||
const tokenUnique = [...new Set(tokenDup.flat())].filter((v: any) => v != undefined && v != null && v != "");
|
const tokenUnique = [...new Set(tokenDup.flat())].filter((v: any) => v != undefined && v != null && v != "");
|
||||||
|
|||||||
@@ -356,11 +356,15 @@ export async function POST(request: Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const dataNotifFilter = dataNotif.filter((v: any) => v.idUserTo != undefined && v.idUserTo != null && v.idUserTo != "" && v.idUserTo != userId)
|
const dataNotifFilter = dataNotif.filter((v: any) => v.idUserTo != undefined && v.idUserTo != null && v.idUserTo != "" && v.idUserTo != userId)
|
||||||
|
const dataNotifFilterUnique = dataNotifFilter
|
||||||
|
.filter((v: any, index: number, self: any[]) =>
|
||||||
|
index === self.findIndex((t: any) => t.idUserTo == v.idUserTo)
|
||||||
|
)
|
||||||
const pushNotif = dataPush.filter((item) => item.subscription != undefined)
|
const pushNotif = dataPush.filter((item) => item.subscription != undefined)
|
||||||
|
|
||||||
const sendWebPush = await funSendWebPush({ sub: pushNotif, message: { body: title, title: 'Tugas Divisi Baru' } })
|
const sendWebPush = await funSendWebPush({ sub: pushNotif, message: { body: title, title: 'Tugas Divisi Baru' } })
|
||||||
const insertNotif = await prisma.notifications.createMany({
|
const insertNotif = await prisma.notifications.createMany({
|
||||||
data: dataNotifFilter
|
data: dataNotifFilterUnique
|
||||||
})
|
})
|
||||||
|
|
||||||
const tokenUnique = [...new Set(tokenDup.flat())].filter((v: any) => v != undefined && v != null && v != "");
|
const tokenUnique = [...new Set(tokenDup.flat())].filter((v: any) => v != undefined && v != null && v != "");
|
||||||
|
|||||||
Reference in New Issue
Block a user