mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
Revision notification (#7)
* Update build-success.ts * Update compose.ts * Update application.ts * Update notification.ts * Update utils.ts * Update dokploy-restart.ts * Update docker-cleanup.ts * Update database-backup.ts * Update build-success.ts * Update build-success.ts
This commit is contained in:
@@ -134,7 +134,7 @@ export const notificationRouter = createTRPCRouter({
|
||||
.input(apiTestTelegramConnection)
|
||||
.mutation(async ({ input }) => {
|
||||
try {
|
||||
await sendTelegramNotification(input, "Hi, From Dokploy 👋", []);
|
||||
await sendTelegramNotification(input, "Hi, From Dokploy 👋");
|
||||
return true;
|
||||
} catch (error) {
|
||||
throw new TRPCError({
|
||||
|
||||
@@ -176,7 +176,6 @@ export const deployApplication = async ({
|
||||
}) => {
|
||||
const application = await findApplicationById(applicationId);
|
||||
const buildLink = `${await getDokployUrl()}/dashboard/project/${application.projectId}/services/application/${application.applicationId}?tab=deployments`;
|
||||
const domains = application.domains.map(({ host, https }) => ({ host, https }));
|
||||
const deployment = await createDeployment({
|
||||
applicationId: applicationId,
|
||||
title: titleLog,
|
||||
@@ -214,7 +213,7 @@ export const deployApplication = async ({
|
||||
applicationType: "application",
|
||||
buildLink,
|
||||
adminId: application.project.adminId,
|
||||
domains
|
||||
domains: application.domains
|
||||
});
|
||||
} catch (error) {
|
||||
await updateDeploymentStatus(deployment.deploymentId, "error");
|
||||
@@ -287,7 +286,6 @@ export const deployRemoteApplication = async ({
|
||||
}) => {
|
||||
const application = await findApplicationById(applicationId);
|
||||
const buildLink = `${await getDokployUrl()}/dashboard/project/${application.projectId}/services/application/${application.applicationId}?tab=deployments`;
|
||||
const domains = application.domains.map(({ host, https }) => ({ host, https }));
|
||||
const deployment = await createDeployment({
|
||||
applicationId: applicationId,
|
||||
title: titleLog,
|
||||
@@ -335,7 +333,7 @@ export const deployRemoteApplication = async ({
|
||||
applicationType: "application",
|
||||
buildLink,
|
||||
adminId: application.project.adminId,
|
||||
domains
|
||||
domains: application.domains
|
||||
});
|
||||
} catch (error) {
|
||||
// @ts-ignore
|
||||
|
||||
@@ -209,7 +209,6 @@ export const deployCompose = async ({
|
||||
const buildLink = `${await getDokployUrl()}/dashboard/project/${
|
||||
compose.projectId
|
||||
}/services/compose/${compose.composeId}?tab=deployments`;
|
||||
const domains = compose.domains.map(({ host, https }) => ({ host, https }));
|
||||
const deployment = await createDeploymentCompose({
|
||||
composeId: composeId,
|
||||
title: titleLog,
|
||||
@@ -244,7 +243,7 @@ export const deployCompose = async ({
|
||||
applicationType: "compose",
|
||||
buildLink,
|
||||
adminId: compose.project.adminId,
|
||||
domains
|
||||
domains: compose.domains,
|
||||
});
|
||||
} catch (error) {
|
||||
await updateDeploymentStatus(deployment.deploymentId, "error");
|
||||
@@ -315,7 +314,6 @@ export const deployRemoteCompose = async ({
|
||||
const buildLink = `${await getDokployUrl()}/dashboard/project/${
|
||||
compose.projectId
|
||||
}/services/compose/${compose.composeId}?tab=deployments`;
|
||||
const domains = compose.domains.map(({ host, https }) => ({ host, https }));
|
||||
const deployment = await createDeploymentCompose({
|
||||
composeId: composeId,
|
||||
title: titleLog,
|
||||
@@ -369,7 +367,7 @@ export const deployRemoteCompose = async ({
|
||||
applicationType: "compose",
|
||||
buildLink,
|
||||
adminId: compose.project.adminId,
|
||||
domains
|
||||
domains: compose.domains,
|
||||
});
|
||||
} catch (error) {
|
||||
// @ts-ignore
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { db } from "@dokploy/server/db";
|
||||
import { notifications } from "@dokploy/server/db/schema";
|
||||
import BuildSuccessEmail from "@dokploy/server/emails/emails/build-success";
|
||||
import { Domain } from "@dokploy/server/services/domain";
|
||||
import { renderAsync } from "@react-email/components";
|
||||
import { and, eq } from "drizzle-orm";
|
||||
import { format } from "date-fns";
|
||||
@@ -17,10 +18,7 @@ interface Props {
|
||||
applicationType: string;
|
||||
buildLink: string;
|
||||
adminId: string;
|
||||
domains: {
|
||||
host: string;
|
||||
https: boolean;
|
||||
}[];
|
||||
domains: Domain[];
|
||||
}
|
||||
|
||||
export const sendBuildSuccessNotifications = async ({
|
||||
|
||||
@@ -130,7 +130,7 @@ export const sendDatabaseBackupNotifications = async ({
|
||||
|
||||
const messageText = `<b>${statusEmoji} Database Backup ${typeStatus}</b>\n\n<b>Project:</b> ${projectName}\n<b>Application:</b> ${applicationName}\n<b>Type:</b> ${databaseType}\n<b>Date:</b> ${format(date, "PP")}\n<b>Time:</b> ${format(date, "pp")}${isError ? errorMsg : ""}`;
|
||||
|
||||
await sendTelegramNotification(telegram, messageText, []);
|
||||
await sendTelegramNotification(telegram, messageText);
|
||||
}
|
||||
|
||||
if (slack) {
|
||||
|
||||
@@ -83,8 +83,7 @@ export const sendDockerCleanupNotifications = async (
|
||||
if (telegram) {
|
||||
await sendTelegramNotification(
|
||||
telegram,
|
||||
`<b>✅ Docker Cleanup</b>\n\n<b>Message:</b> ${message}\n<b>Date:</b> ${format(date, "PP")}\n<b>Time:</b> ${format(date, "pp")}`,
|
||||
[]
|
||||
`<b>✅ Docker Cleanup</b>\n\n<b>Message:</b> ${message}\n<b>Date:</b> ${format(date, "PP")}\n<b>Time:</b> ${format(date, "pp")}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,8 +68,7 @@ export const sendDokployRestartNotifications = async () => {
|
||||
if (telegram) {
|
||||
await sendTelegramNotification(
|
||||
telegram,
|
||||
`<b>✅ Dokploy Serverd Restarted</b>\n\n<b>Date:</b> ${format(date, "PP")}\n<b>Time:</b> ${format(date, "pp")}`,
|
||||
[]
|
||||
`<b>✅ Dokploy Serverd Restarted</b>\n\n<b>Date:</b> ${format(date, "PP")}\n<b>Time:</b> ${format(date, "pp")}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ export const sendDiscordNotification = async (
|
||||
export const sendTelegramNotification = async (
|
||||
connection: typeof telegram.$inferInsert,
|
||||
messageText: string,
|
||||
inlineButton: {
|
||||
inlineButton?: {
|
||||
text: string;
|
||||
url: string;
|
||||
}[][]
|
||||
|
||||
Reference in New Issue
Block a user