mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-28 02:25:23 +02:00
feat(notifications): add custom notification type and enhance notification schema with custom handling
This commit is contained in:
12
apps/dokploy/drizzle/0113_keen_wasp.sql
Normal file
12
apps/dokploy/drizzle/0113_keen_wasp.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
ALTER TYPE "public"."notificationType" ADD VALUE 'custom';--> statement-breakpoint
|
||||
CREATE TABLE "custom" (
|
||||
"customId" text PRIMARY KEY NOT NULL,
|
||||
"endpoint" text NOT NULL,
|
||||
"httpMethod" text DEFAULT 'POST' NOT NULL,
|
||||
"headers" text,
|
||||
"body" text,
|
||||
"queryParams" text
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "notification" ADD COLUMN "customId" text;--> statement-breakpoint
|
||||
ALTER TABLE "notification" ADD CONSTRAINT "notification_customId_custom_customId_fk" FOREIGN KEY ("customId") REFERENCES "public"."custom"("customId") ON DELETE cascade ON UPDATE no action;
|
||||
3
apps/dokploy/drizzle/0114_smart_shape.sql
Normal file
3
apps/dokploy/drizzle/0114_smart_shape.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE "custom" DROP COLUMN "httpMethod";--> statement-breakpoint
|
||||
ALTER TABLE "custom" DROP COLUMN "body";--> statement-breakpoint
|
||||
ALTER TABLE "custom" DROP COLUMN "queryParams";
|
||||
6641
apps/dokploy/drizzle/meta/0113_snapshot.json
Normal file
6641
apps/dokploy/drizzle/meta/0113_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
6622
apps/dokploy/drizzle/meta/0114_snapshot.json
Normal file
6622
apps/dokploy/drizzle/meta/0114_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -792,6 +792,20 @@
|
||||
"when": 1758483520214,
|
||||
"tag": "0112_freezing_skrulls",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 113,
|
||||
"version": "7",
|
||||
"when": 1758913506515,
|
||||
"tag": "0113_keen_wasp",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 114,
|
||||
"version": "7",
|
||||
"when": 1758914193619,
|
||||
"tag": "0114_smart_shape",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -6,355 +6,400 @@ import { z } from "zod";
|
||||
import { organization } from "./account";
|
||||
|
||||
export const notificationType = pgEnum("notificationType", [
|
||||
"slack",
|
||||
"telegram",
|
||||
"discord",
|
||||
"email",
|
||||
"gotify",
|
||||
"ntfy",
|
||||
"slack",
|
||||
"telegram",
|
||||
"discord",
|
||||
"email",
|
||||
"gotify",
|
||||
"ntfy",
|
||||
"custom",
|
||||
]);
|
||||
|
||||
export const notifications = pgTable("notification", {
|
||||
notificationId: text("notificationId")
|
||||
.notNull()
|
||||
.primaryKey()
|
||||
.$defaultFn(() => nanoid()),
|
||||
name: text("name").notNull(),
|
||||
appDeploy: boolean("appDeploy").notNull().default(false),
|
||||
appBuildError: boolean("appBuildError").notNull().default(false),
|
||||
databaseBackup: boolean("databaseBackup").notNull().default(false),
|
||||
dokployRestart: boolean("dokployRestart").notNull().default(false),
|
||||
dockerCleanup: boolean("dockerCleanup").notNull().default(false),
|
||||
serverThreshold: boolean("serverThreshold").notNull().default(false),
|
||||
notificationType: notificationType("notificationType").notNull(),
|
||||
createdAt: text("createdAt")
|
||||
.notNull()
|
||||
.$defaultFn(() => new Date().toISOString()),
|
||||
slackId: text("slackId").references(() => slack.slackId, {
|
||||
onDelete: "cascade",
|
||||
}),
|
||||
telegramId: text("telegramId").references(() => telegram.telegramId, {
|
||||
onDelete: "cascade",
|
||||
}),
|
||||
discordId: text("discordId").references(() => discord.discordId, {
|
||||
onDelete: "cascade",
|
||||
}),
|
||||
emailId: text("emailId").references(() => email.emailId, {
|
||||
onDelete: "cascade",
|
||||
}),
|
||||
gotifyId: text("gotifyId").references(() => gotify.gotifyId, {
|
||||
onDelete: "cascade",
|
||||
}),
|
||||
ntfyId: text("ntfyId").references(() => ntfy.ntfyId, {
|
||||
onDelete: "cascade",
|
||||
}),
|
||||
organizationId: text("organizationId")
|
||||
.notNull()
|
||||
.references(() => organization.id, { onDelete: "cascade" }),
|
||||
notificationId: text("notificationId")
|
||||
.notNull()
|
||||
.primaryKey()
|
||||
.$defaultFn(() => nanoid()),
|
||||
name: text("name").notNull(),
|
||||
appDeploy: boolean("appDeploy").notNull().default(false),
|
||||
appBuildError: boolean("appBuildError").notNull().default(false),
|
||||
databaseBackup: boolean("databaseBackup").notNull().default(false),
|
||||
dokployRestart: boolean("dokployRestart").notNull().default(false),
|
||||
dockerCleanup: boolean("dockerCleanup").notNull().default(false),
|
||||
serverThreshold: boolean("serverThreshold").notNull().default(false),
|
||||
notificationType: notificationType("notificationType").notNull(),
|
||||
createdAt: text("createdAt")
|
||||
.notNull()
|
||||
.$defaultFn(() => new Date().toISOString()),
|
||||
slackId: text("slackId").references(() => slack.slackId, {
|
||||
onDelete: "cascade",
|
||||
}),
|
||||
telegramId: text("telegramId").references(() => telegram.telegramId, {
|
||||
onDelete: "cascade",
|
||||
}),
|
||||
discordId: text("discordId").references(() => discord.discordId, {
|
||||
onDelete: "cascade",
|
||||
}),
|
||||
emailId: text("emailId").references(() => email.emailId, {
|
||||
onDelete: "cascade",
|
||||
}),
|
||||
gotifyId: text("gotifyId").references(() => gotify.gotifyId, {
|
||||
onDelete: "cascade",
|
||||
}),
|
||||
ntfyId: text("ntfyId").references(() => ntfy.ntfyId, {
|
||||
onDelete: "cascade",
|
||||
}),
|
||||
customId: text("customId").references(() => custom.customId, {
|
||||
onDelete: "cascade",
|
||||
}),
|
||||
organizationId: text("organizationId")
|
||||
.notNull()
|
||||
.references(() => organization.id, { onDelete: "cascade" }),
|
||||
});
|
||||
|
||||
export const slack = pgTable("slack", {
|
||||
slackId: text("slackId")
|
||||
.notNull()
|
||||
.primaryKey()
|
||||
.$defaultFn(() => nanoid()),
|
||||
webhookUrl: text("webhookUrl").notNull(),
|
||||
channel: text("channel"),
|
||||
slackId: text("slackId")
|
||||
.notNull()
|
||||
.primaryKey()
|
||||
.$defaultFn(() => nanoid()),
|
||||
webhookUrl: text("webhookUrl").notNull(),
|
||||
channel: text("channel"),
|
||||
});
|
||||
|
||||
export const telegram = pgTable("telegram", {
|
||||
telegramId: text("telegramId")
|
||||
.notNull()
|
||||
.primaryKey()
|
||||
.$defaultFn(() => nanoid()),
|
||||
botToken: text("botToken").notNull(),
|
||||
chatId: text("chatId").notNull(),
|
||||
messageThreadId: text("messageThreadId"),
|
||||
telegramId: text("telegramId")
|
||||
.notNull()
|
||||
.primaryKey()
|
||||
.$defaultFn(() => nanoid()),
|
||||
botToken: text("botToken").notNull(),
|
||||
chatId: text("chatId").notNull(),
|
||||
messageThreadId: text("messageThreadId"),
|
||||
});
|
||||
|
||||
export const discord = pgTable("discord", {
|
||||
discordId: text("discordId")
|
||||
.notNull()
|
||||
.primaryKey()
|
||||
.$defaultFn(() => nanoid()),
|
||||
webhookUrl: text("webhookUrl").notNull(),
|
||||
decoration: boolean("decoration"),
|
||||
discordId: text("discordId")
|
||||
.notNull()
|
||||
.primaryKey()
|
||||
.$defaultFn(() => nanoid()),
|
||||
webhookUrl: text("webhookUrl").notNull(),
|
||||
decoration: boolean("decoration"),
|
||||
});
|
||||
|
||||
export const email = pgTable("email", {
|
||||
emailId: text("emailId")
|
||||
.notNull()
|
||||
.primaryKey()
|
||||
.$defaultFn(() => nanoid()),
|
||||
smtpServer: text("smtpServer").notNull(),
|
||||
smtpPort: integer("smtpPort").notNull(),
|
||||
username: text("username").notNull(),
|
||||
password: text("password").notNull(),
|
||||
fromAddress: text("fromAddress").notNull(),
|
||||
toAddresses: text("toAddress").array().notNull(),
|
||||
emailId: text("emailId")
|
||||
.notNull()
|
||||
.primaryKey()
|
||||
.$defaultFn(() => nanoid()),
|
||||
smtpServer: text("smtpServer").notNull(),
|
||||
smtpPort: integer("smtpPort").notNull(),
|
||||
username: text("username").notNull(),
|
||||
password: text("password").notNull(),
|
||||
fromAddress: text("fromAddress").notNull(),
|
||||
toAddresses: text("toAddress").array().notNull(),
|
||||
});
|
||||
|
||||
export const gotify = pgTable("gotify", {
|
||||
gotifyId: text("gotifyId")
|
||||
.notNull()
|
||||
.primaryKey()
|
||||
.$defaultFn(() => nanoid()),
|
||||
serverUrl: text("serverUrl").notNull(),
|
||||
appToken: text("appToken").notNull(),
|
||||
priority: integer("priority").notNull().default(5),
|
||||
decoration: boolean("decoration"),
|
||||
gotifyId: text("gotifyId")
|
||||
.notNull()
|
||||
.primaryKey()
|
||||
.$defaultFn(() => nanoid()),
|
||||
serverUrl: text("serverUrl").notNull(),
|
||||
appToken: text("appToken").notNull(),
|
||||
priority: integer("priority").notNull().default(5),
|
||||
decoration: boolean("decoration"),
|
||||
});
|
||||
|
||||
export const ntfy = pgTable("ntfy", {
|
||||
ntfyId: text("ntfyId")
|
||||
.notNull()
|
||||
.primaryKey()
|
||||
.$defaultFn(() => nanoid()),
|
||||
serverUrl: text("serverUrl").notNull(),
|
||||
topic: text("topic").notNull(),
|
||||
accessToken: text("accessToken").notNull(),
|
||||
priority: integer("priority").notNull().default(3),
|
||||
ntfyId: text("ntfyId")
|
||||
.notNull()
|
||||
.primaryKey()
|
||||
.$defaultFn(() => nanoid()),
|
||||
serverUrl: text("serverUrl").notNull(),
|
||||
topic: text("topic").notNull(),
|
||||
accessToken: text("accessToken").notNull(),
|
||||
priority: integer("priority").notNull().default(3),
|
||||
});
|
||||
|
||||
export const custom = pgTable("custom", {
|
||||
customId: text("customId")
|
||||
.notNull()
|
||||
.primaryKey()
|
||||
.$defaultFn(() => nanoid()),
|
||||
endpoint: text("endpoint").notNull(),
|
||||
headers: text("headers"), // JSON string
|
||||
});
|
||||
|
||||
export const notificationsRelations = relations(notifications, ({ one }) => ({
|
||||
slack: one(slack, {
|
||||
fields: [notifications.slackId],
|
||||
references: [slack.slackId],
|
||||
}),
|
||||
telegram: one(telegram, {
|
||||
fields: [notifications.telegramId],
|
||||
references: [telegram.telegramId],
|
||||
}),
|
||||
discord: one(discord, {
|
||||
fields: [notifications.discordId],
|
||||
references: [discord.discordId],
|
||||
}),
|
||||
email: one(email, {
|
||||
fields: [notifications.emailId],
|
||||
references: [email.emailId],
|
||||
}),
|
||||
gotify: one(gotify, {
|
||||
fields: [notifications.gotifyId],
|
||||
references: [gotify.gotifyId],
|
||||
}),
|
||||
ntfy: one(ntfy, {
|
||||
fields: [notifications.ntfyId],
|
||||
references: [ntfy.ntfyId],
|
||||
}),
|
||||
organization: one(organization, {
|
||||
fields: [notifications.organizationId],
|
||||
references: [organization.id],
|
||||
}),
|
||||
slack: one(slack, {
|
||||
fields: [notifications.slackId],
|
||||
references: [slack.slackId],
|
||||
}),
|
||||
telegram: one(telegram, {
|
||||
fields: [notifications.telegramId],
|
||||
references: [telegram.telegramId],
|
||||
}),
|
||||
discord: one(discord, {
|
||||
fields: [notifications.discordId],
|
||||
references: [discord.discordId],
|
||||
}),
|
||||
email: one(email, {
|
||||
fields: [notifications.emailId],
|
||||
references: [email.emailId],
|
||||
}),
|
||||
gotify: one(gotify, {
|
||||
fields: [notifications.gotifyId],
|
||||
references: [gotify.gotifyId],
|
||||
}),
|
||||
ntfy: one(ntfy, {
|
||||
fields: [notifications.ntfyId],
|
||||
references: [ntfy.ntfyId],
|
||||
}),
|
||||
custom: one(custom, {
|
||||
fields: [notifications.customId],
|
||||
references: [custom.customId],
|
||||
}),
|
||||
organization: one(organization, {
|
||||
fields: [notifications.organizationId],
|
||||
references: [organization.id],
|
||||
}),
|
||||
}));
|
||||
|
||||
export const notificationsSchema = createInsertSchema(notifications);
|
||||
|
||||
export const apiCreateSlack = notificationsSchema
|
||||
.pick({
|
||||
appBuildError: true,
|
||||
databaseBackup: true,
|
||||
dokployRestart: true,
|
||||
name: true,
|
||||
appDeploy: true,
|
||||
dockerCleanup: true,
|
||||
serverThreshold: true,
|
||||
})
|
||||
.extend({
|
||||
webhookUrl: z.string().min(1),
|
||||
channel: z.string(),
|
||||
})
|
||||
.required();
|
||||
.pick({
|
||||
appBuildError: true,
|
||||
databaseBackup: true,
|
||||
dokployRestart: true,
|
||||
name: true,
|
||||
appDeploy: true,
|
||||
dockerCleanup: true,
|
||||
serverThreshold: true,
|
||||
})
|
||||
.extend({
|
||||
webhookUrl: z.string().min(1),
|
||||
channel: z.string(),
|
||||
})
|
||||
.required();
|
||||
|
||||
export const apiUpdateSlack = apiCreateSlack.partial().extend({
|
||||
notificationId: z.string().min(1),
|
||||
slackId: z.string(),
|
||||
organizationId: z.string().optional(),
|
||||
notificationId: z.string().min(1),
|
||||
slackId: z.string(),
|
||||
organizationId: z.string().optional(),
|
||||
});
|
||||
|
||||
export const apiTestSlackConnection = apiCreateSlack.pick({
|
||||
webhookUrl: true,
|
||||
channel: true,
|
||||
webhookUrl: true,
|
||||
channel: true,
|
||||
});
|
||||
|
||||
export const apiCreateTelegram = notificationsSchema
|
||||
.pick({
|
||||
appBuildError: true,
|
||||
databaseBackup: true,
|
||||
dokployRestart: true,
|
||||
name: true,
|
||||
appDeploy: true,
|
||||
dockerCleanup: true,
|
||||
serverThreshold: true,
|
||||
})
|
||||
.extend({
|
||||
botToken: z.string().min(1),
|
||||
chatId: z.string().min(1),
|
||||
messageThreadId: z.string(),
|
||||
})
|
||||
.required();
|
||||
.pick({
|
||||
appBuildError: true,
|
||||
databaseBackup: true,
|
||||
dokployRestart: true,
|
||||
name: true,
|
||||
appDeploy: true,
|
||||
dockerCleanup: true,
|
||||
serverThreshold: true,
|
||||
})
|
||||
.extend({
|
||||
botToken: z.string().min(1),
|
||||
chatId: z.string().min(1),
|
||||
messageThreadId: z.string(),
|
||||
})
|
||||
.required();
|
||||
|
||||
export const apiUpdateTelegram = apiCreateTelegram.partial().extend({
|
||||
notificationId: z.string().min(1),
|
||||
telegramId: z.string().min(1),
|
||||
organizationId: z.string().optional(),
|
||||
notificationId: z.string().min(1),
|
||||
telegramId: z.string().min(1),
|
||||
organizationId: z.string().optional(),
|
||||
});
|
||||
|
||||
export const apiTestTelegramConnection = apiCreateTelegram.pick({
|
||||
botToken: true,
|
||||
chatId: true,
|
||||
messageThreadId: true,
|
||||
botToken: true,
|
||||
chatId: true,
|
||||
messageThreadId: true,
|
||||
});
|
||||
|
||||
export const apiCreateDiscord = notificationsSchema
|
||||
.pick({
|
||||
appBuildError: true,
|
||||
databaseBackup: true,
|
||||
dokployRestart: true,
|
||||
name: true,
|
||||
appDeploy: true,
|
||||
dockerCleanup: true,
|
||||
serverThreshold: true,
|
||||
})
|
||||
.extend({
|
||||
webhookUrl: z.string().min(1),
|
||||
decoration: z.boolean(),
|
||||
})
|
||||
.required();
|
||||
.pick({
|
||||
appBuildError: true,
|
||||
databaseBackup: true,
|
||||
dokployRestart: true,
|
||||
name: true,
|
||||
appDeploy: true,
|
||||
dockerCleanup: true,
|
||||
serverThreshold: true,
|
||||
})
|
||||
.extend({
|
||||
webhookUrl: z.string().min(1),
|
||||
decoration: z.boolean(),
|
||||
})
|
||||
.required();
|
||||
|
||||
export const apiUpdateDiscord = apiCreateDiscord.partial().extend({
|
||||
notificationId: z.string().min(1),
|
||||
discordId: z.string().min(1),
|
||||
organizationId: z.string().optional(),
|
||||
notificationId: z.string().min(1),
|
||||
discordId: z.string().min(1),
|
||||
organizationId: z.string().optional(),
|
||||
});
|
||||
|
||||
export const apiTestDiscordConnection = apiCreateDiscord
|
||||
.pick({
|
||||
webhookUrl: true,
|
||||
})
|
||||
.extend({
|
||||
decoration: z.boolean().optional(),
|
||||
});
|
||||
.pick({
|
||||
webhookUrl: true,
|
||||
})
|
||||
.extend({
|
||||
decoration: z.boolean().optional(),
|
||||
});
|
||||
|
||||
export const apiCreateEmail = notificationsSchema
|
||||
.pick({
|
||||
appBuildError: true,
|
||||
databaseBackup: true,
|
||||
dokployRestart: true,
|
||||
name: true,
|
||||
appDeploy: true,
|
||||
dockerCleanup: true,
|
||||
serverThreshold: true,
|
||||
})
|
||||
.extend({
|
||||
smtpServer: z.string().min(1),
|
||||
smtpPort: z.number().min(1),
|
||||
username: z.string().min(1),
|
||||
password: z.string().min(1),
|
||||
fromAddress: z.string().min(1),
|
||||
toAddresses: z.array(z.string()).min(1),
|
||||
})
|
||||
.required();
|
||||
.pick({
|
||||
appBuildError: true,
|
||||
databaseBackup: true,
|
||||
dokployRestart: true,
|
||||
name: true,
|
||||
appDeploy: true,
|
||||
dockerCleanup: true,
|
||||
serverThreshold: true,
|
||||
})
|
||||
.extend({
|
||||
smtpServer: z.string().min(1),
|
||||
smtpPort: z.number().min(1),
|
||||
username: z.string().min(1),
|
||||
password: z.string().min(1),
|
||||
fromAddress: z.string().min(1),
|
||||
toAddresses: z.array(z.string()).min(1),
|
||||
})
|
||||
.required();
|
||||
|
||||
export const apiUpdateEmail = apiCreateEmail.partial().extend({
|
||||
notificationId: z.string().min(1),
|
||||
emailId: z.string().min(1),
|
||||
organizationId: z.string().optional(),
|
||||
notificationId: z.string().min(1),
|
||||
emailId: z.string().min(1),
|
||||
organizationId: z.string().optional(),
|
||||
});
|
||||
|
||||
export const apiTestEmailConnection = apiCreateEmail.pick({
|
||||
smtpServer: true,
|
||||
smtpPort: true,
|
||||
username: true,
|
||||
password: true,
|
||||
toAddresses: true,
|
||||
fromAddress: true,
|
||||
smtpServer: true,
|
||||
smtpPort: true,
|
||||
username: true,
|
||||
password: true,
|
||||
toAddresses: true,
|
||||
fromAddress: true,
|
||||
});
|
||||
|
||||
export const apiCreateGotify = notificationsSchema
|
||||
.pick({
|
||||
appBuildError: true,
|
||||
databaseBackup: true,
|
||||
dokployRestart: true,
|
||||
name: true,
|
||||
appDeploy: true,
|
||||
dockerCleanup: true,
|
||||
})
|
||||
.extend({
|
||||
serverUrl: z.string().min(1),
|
||||
appToken: z.string().min(1),
|
||||
priority: z.number().min(1),
|
||||
decoration: z.boolean(),
|
||||
})
|
||||
.required();
|
||||
.pick({
|
||||
appBuildError: true,
|
||||
databaseBackup: true,
|
||||
dokployRestart: true,
|
||||
name: true,
|
||||
appDeploy: true,
|
||||
dockerCleanup: true,
|
||||
})
|
||||
.extend({
|
||||
serverUrl: z.string().min(1),
|
||||
appToken: z.string().min(1),
|
||||
priority: z.number().min(1),
|
||||
decoration: z.boolean(),
|
||||
})
|
||||
.required();
|
||||
|
||||
export const apiUpdateGotify = apiCreateGotify.partial().extend({
|
||||
notificationId: z.string().min(1),
|
||||
gotifyId: z.string().min(1),
|
||||
organizationId: z.string().optional(),
|
||||
notificationId: z.string().min(1),
|
||||
gotifyId: z.string().min(1),
|
||||
organizationId: z.string().optional(),
|
||||
});
|
||||
|
||||
export const apiTestGotifyConnection = apiCreateGotify
|
||||
.pick({
|
||||
serverUrl: true,
|
||||
appToken: true,
|
||||
priority: true,
|
||||
})
|
||||
.extend({
|
||||
decoration: z.boolean().optional(),
|
||||
});
|
||||
.pick({
|
||||
serverUrl: true,
|
||||
appToken: true,
|
||||
priority: true,
|
||||
})
|
||||
.extend({
|
||||
decoration: z.boolean().optional(),
|
||||
});
|
||||
|
||||
export const apiCreateNtfy = notificationsSchema
|
||||
.pick({
|
||||
appBuildError: true,
|
||||
databaseBackup: true,
|
||||
dokployRestart: true,
|
||||
name: true,
|
||||
appDeploy: true,
|
||||
dockerCleanup: true,
|
||||
})
|
||||
.extend({
|
||||
serverUrl: z.string().min(1),
|
||||
topic: z.string().min(1),
|
||||
accessToken: z.string().min(1),
|
||||
priority: z.number().min(1),
|
||||
})
|
||||
.required();
|
||||
.pick({
|
||||
appBuildError: true,
|
||||
databaseBackup: true,
|
||||
dokployRestart: true,
|
||||
name: true,
|
||||
appDeploy: true,
|
||||
dockerCleanup: true,
|
||||
})
|
||||
.extend({
|
||||
serverUrl: z.string().min(1),
|
||||
topic: z.string().min(1),
|
||||
accessToken: z.string().min(1),
|
||||
priority: z.number().min(1),
|
||||
})
|
||||
.required();
|
||||
|
||||
export const apiUpdateNtfy = apiCreateNtfy.partial().extend({
|
||||
notificationId: z.string().min(1),
|
||||
ntfyId: z.string().min(1),
|
||||
organizationId: z.string().optional(),
|
||||
notificationId: z.string().min(1),
|
||||
ntfyId: z.string().min(1),
|
||||
organizationId: z.string().optional(),
|
||||
});
|
||||
|
||||
export const apiTestNtfyConnection = apiCreateNtfy.pick({
|
||||
serverUrl: true,
|
||||
topic: true,
|
||||
accessToken: true,
|
||||
priority: true,
|
||||
serverUrl: true,
|
||||
topic: true,
|
||||
accessToken: true,
|
||||
priority: true,
|
||||
});
|
||||
|
||||
export const apiFindOneNotification = notificationsSchema
|
||||
.pick({
|
||||
notificationId: true,
|
||||
})
|
||||
.required();
|
||||
.pick({
|
||||
notificationId: true,
|
||||
})
|
||||
.required();
|
||||
|
||||
export const apiCreateCustom = notificationsSchema
|
||||
.pick({
|
||||
appBuildError: true,
|
||||
databaseBackup: true,
|
||||
dokployRestart: true,
|
||||
name: true,
|
||||
appDeploy: true,
|
||||
dockerCleanup: true,
|
||||
serverThreshold: true,
|
||||
})
|
||||
.extend({
|
||||
endpoint: z.string().min(1),
|
||||
headers: z.string().optional(),
|
||||
});
|
||||
|
||||
export const apiUpdateCustom = apiCreateCustom.partial().extend({
|
||||
notificationId: z.string().min(1),
|
||||
customId: z.string().min(1),
|
||||
organizationId: z.string().optional(),
|
||||
});
|
||||
|
||||
export const apiTestCustomConnection = z.object({
|
||||
endpoint: z.string().min(1),
|
||||
headers: z.string().optional(),
|
||||
});
|
||||
|
||||
export const apiSendTest = notificationsSchema
|
||||
.extend({
|
||||
botToken: z.string(),
|
||||
chatId: z.string(),
|
||||
webhookUrl: z.string(),
|
||||
channel: z.string(),
|
||||
smtpServer: z.string(),
|
||||
smtpPort: z.number(),
|
||||
fromAddress: z.string(),
|
||||
username: z.string(),
|
||||
password: z.string(),
|
||||
toAddresses: z.array(z.string()),
|
||||
serverUrl: z.string(),
|
||||
topic: z.string(),
|
||||
appToken: z.string(),
|
||||
accessToken: z.string(),
|
||||
priority: z.number(),
|
||||
})
|
||||
.partial();
|
||||
.extend({
|
||||
botToken: z.string(),
|
||||
chatId: z.string(),
|
||||
webhookUrl: z.string(),
|
||||
channel: z.string(),
|
||||
smtpServer: z.string(),
|
||||
smtpPort: z.number(),
|
||||
fromAddress: z.string(),
|
||||
username: z.string(),
|
||||
password: z.string(),
|
||||
toAddresses: z.array(z.string()),
|
||||
serverUrl: z.string(),
|
||||
topic: z.string(),
|
||||
appToken: z.string(),
|
||||
accessToken: z.string(),
|
||||
priority: z.number(),
|
||||
endpoint: z.string(),
|
||||
headers: z.string(),
|
||||
})
|
||||
.partial();
|
||||
|
||||
Reference in New Issue
Block a user