upd: notif insert

Deskripsi:
- mengganti kalimat notifikasi sesuai dengan content yg diinputkan
- upd api version

No Issues
This commit is contained in:
2025-09-30 14:40:37 +08:00
parent 6910f8fdff
commit 9a6a4d66df
15 changed files with 67 additions and 60 deletions

View File

@@ -103,11 +103,13 @@ export async function POST(request: Request, context: { params: { id: string } }
tokenDup.push(perbekel?.TokenDeviceUser.map((v: any) => v.token).flat())
}
const commentNotif = data.comment.length > 300 ? data.comment.substring(0, 300) + '...' : data.comment;
const tokenUnique = [...new Set(tokenDup.flat())].filter((v: any) => v != undefined && v != null && v != "");
await sendFCMNotificationMany({
token: tokenUnique,
title: "Komentar Baru",
body: `${userSent?.name}: ${data.comment}`,
body: `${userSent?.name}: ${commentNotif}`,
data: { id: data.id, category: "discussion-general", content: id }
})