feat: Nambahin feature notifikasi

This commit is contained in:
Rafi Athallah
2026-06-23 14:51:31 +07:00
parent 24a3ec7fd0
commit 0e9498a2d0
14 changed files with 1185 additions and 11 deletions
@@ -1,4 +1,5 @@
const projectRepository = require("../repositories/project.repository");
const notificationService = require("../../notification/services/notification.service");
const { data, error } = require("../../../helpers/utils/wrapper");
const {
BadRequestError,
@@ -86,6 +87,14 @@ class ProjectService {
userIds,
);
for (const idUser of userIds) {
await notificationService.createNotificationForIntern(
idUser,
"Diterima ke Proyek",
`Anda telah bergabung ke proyek '${project.project_name}'.`
).catch(err => console.error("Failed to send project assignment notification:", err));
}
return data(this.mapProjectDetail(project));
} catch (err) {
return error(err);
@@ -516,6 +525,12 @@ class ProjectService {
membership = await projectRepository.assignMember(id_project, id_user);
}
await notificationService.createNotificationForIntern(
id_user,
"Diterima ke Proyek",
`Anda telah bergabung ke proyek '${project.project_name}'.`
).catch(err => console.error("Failed to send project assignment notification:", err));
return data(membership);
} catch (err) {
return error(err);