extrat userId and teamId from req.uesr
This commit is contained in:
1 parent
bfae00b69b
commit
5aae164865
1 file changed
+6
-1
@@ -102,6 +102,7 @@ class NotificationController {
|
|||||||
success =
|
success =
|
||||||
await this.notificationService.sendTestPagerDutyNotification(notification);
|
await this.notificationService.sendTestPagerDutyNotification(notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
return res.error({
|
return res.error({
|
||||||
msg: "Sending notification failed",
|
msg: "Sending notification failed",
|
||||||
@@ -128,7 +129,11 @@ class NotificationController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
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({
|
return res.success({
|
||||||
msg: "Notification created successfully",
|
msg: "Notification created successfully",
|
||||||
data: notification,
|
data: notification,
|
||||||
|
|||||||
Reference in new issue
Block a user