upd: notifikasi

Deskripsi:
- update notifikasi pada create diskusi, divisi, project dan task

No Issues
This commit is contained in:
amel
2024-09-20 16:38:36 +08:00
parent 2b89518e4f
commit 0e73df39c4
4 changed files with 124 additions and 10 deletions

View File

@@ -206,6 +206,35 @@ export async function POST(request: Request) {
})
}
const memberDivision = await prisma.divisionMember.findMany({
where: {
idDivision: idDivision
},
select: {
User: {
select: {
id: true
}
}
}
})
const dataNotif = memberDivision.map((v: any) => ({
..._.omit(v, ["User"]),
idUserTo: v.User.id,
idUserFrom: String(user.id),
category: 'division/' + idDivision + '/task',
idContent: data.id,
title: 'Tugas Baru',
desc: 'Terdapat tugas baru. Silahkan periksa detailnya.'
}))
const insertNotif = await prisma.notifications.createMany({
data: dataNotif
})
// create log user
const log = await createLogUser({ act: 'CREATE', desc: 'User membuat tugas divisi baru', table: 'divisionProject', data: data.id })