extrat userId and teamId from req.uesr

This commit is contained in:
Alex Holliday
2025-06-16 10:37:04 +08:00
parent bfae00b69b
commit 5aae164865

View File

@@ -102,6 +102,7 @@ class NotificationController {
success =
await this.notificationService.sendTestPagerDutyNotification(notification);
}
if (!success) {
return res.error({
msg: "Sending notification failed",
@@ -128,7 +129,11 @@ class NotificationController {
}
try {
const notification = await this.db.createNotification(req.body);
const body = req.body;
const { _id, teamId } = req.user;
body.userId = _id;
body.teamId = teamId;
const notification = await this.db.createNotification(body);
return res.success({
msg: "Notification created successfully",
data: notification,