Merge pull request #2458 from bluewave-labs/feat/discord-notification-channel
feat: discord notification channel
This commit is contained in:
6 files changed
+71
-27
No files matched your search
@@ -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,
|
||||
|
||||
@@ -7,7 +7,7 @@ const configSchema = mongoose.Schema(
|
||||
chatId: { type: String },
|
||||
platform: {
|
||||
type: String,
|
||||
enum: ["slack", "pager_duty", "webhook"],
|
||||
enum: ["slack", "pager_duty", "webhook", "discord"],
|
||||
},
|
||||
routingKey: { type: String },
|
||||
},
|
||||
|
||||
@@ -558,14 +558,6 @@ const triggerNotificationBodyValidation = joi.object({
|
||||
});
|
||||
|
||||
const createNotificationBodyValidation = joi.object({
|
||||
userId: joi.string().required().messages({
|
||||
"number.empty": "User ID is required",
|
||||
"any.required": "User ID is required",
|
||||
}),
|
||||
teamId: joi.string().required().messages({
|
||||
"string.empty": "Team ID is required",
|
||||
"any.required": "Team ID is required",
|
||||
}),
|
||||
notificationName: joi.string().required().messages({
|
||||
"string.empty": "Notification name is required",
|
||||
"any.required": "Notification name is required",
|
||||
|
||||
Reference in new issue
Block a user