update schema and validation

This commit is contained in:
Alex Holliday committed 2025-06-18 14:42:59 +08:00
1 parent bb921690bf
commit 7bca60269c
2 files changed
+9 -39

No files matched your search

+1 -22
View File
@@ -1,19 +1,5 @@
import mongoose from "mongoose";
const configSchema = mongoose.Schema(
{
webhookUrl: { type: String },
botToken: { type: String },
chatId: { type: String },
platform: {
type: String,
enum: ["slack", "pager_duty", "webhook", "discord"],
},
routingKey: { type: String },
},
{ _id: false }
);
const NotificationSchema = mongoose.Schema(
{
userId: {
@@ -30,14 +16,7 @@ const NotificationSchema = mongoose.Schema(
},
type: {
type: String,
enum: ["email", "sms", "webhook", "pager_duty"],
},
platform: {
type: String,
},
config: {
type: configSchema,
default: () => ({}),
enum: ["email", "slack", "discord", "webhook", "pager_duty"],
},
notificationName: {
type: String,