upd: notif insert
Deskripsi: - mengganti kalimat notifikasi sesuai dengan content yg diinputkan - upd api version No Issues
This commit is contained in:
@@ -146,6 +146,8 @@ export async function POST(request: Request) {
|
||||
}
|
||||
})
|
||||
|
||||
const descNotif = desc.length > 300 ? desc.substring(0, 300) + '...' : desc
|
||||
|
||||
|
||||
// mengirim notifikasi
|
||||
// datanotif untuk realtime notifikasi
|
||||
@@ -157,7 +159,7 @@ export async function POST(request: Request) {
|
||||
category: 'division/' + idDivision + '/discussion',
|
||||
idContent: data.id,
|
||||
title: 'Diskusi Baru',
|
||||
desc: 'Terdapat diskusi baru. Silakan periksa detailnya.'
|
||||
desc: descNotif
|
||||
}))
|
||||
|
||||
const dataPush = memberDivision.map((v: any) => ({
|
||||
@@ -189,7 +191,7 @@ export async function POST(request: Request) {
|
||||
category: 'division/' + idDivision + '/discussion',
|
||||
idContent: data.id,
|
||||
title: 'Diskusi Baru',
|
||||
desc: 'Terdapat diskusi baru. Silakan periksa detailnya.'
|
||||
desc: descNotif
|
||||
})
|
||||
|
||||
dataPush.push({
|
||||
@@ -221,7 +223,7 @@ export async function POST(request: Request) {
|
||||
category: 'division/' + idDivision + '/discussion',
|
||||
idContent: data.id,
|
||||
title: 'Diskusi Baru',
|
||||
desc: 'Terdapat diskusi baru. Silakan periksa detailnya.'
|
||||
desc: descNotif
|
||||
})
|
||||
|
||||
dataPush.push({
|
||||
@@ -232,7 +234,7 @@ export async function POST(request: Request) {
|
||||
|
||||
const pushNotif = dataPush.filter((item) => item.subscription != undefined)
|
||||
|
||||
const sendWebPush = await funSendWebPush({ sub: pushNotif, message: { body: 'Terdapat diskusi baru. Silakan periksa detailnya.', title: 'Diskusi Baru' } })
|
||||
const sendWebPush = await funSendWebPush({ sub: pushNotif, message: { body: descNotif, title: 'Diskusi Baru' } })
|
||||
const insertNotif = await prisma.notifications.createMany({
|
||||
data: dataNotif
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user