mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-15 20:25:23 +02:00
- Introduced a new endpoint for cancelling deployments, allowing users to cancel both application and compose deployments. - Implemented validation schemas for cancellation requests. - Enhanced the deployment dashboard to provide a cancellation option for stuck deployments. - Updated server-side logic to handle cancellation requests and send appropriate events.
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { z } from "zod";
|
|
|
|
export const deployJobSchema = z.discriminatedUnion("applicationType", [
|
|
z.object({
|
|
applicationId: z.string(),
|
|
titleLog: z.string().optional(),
|
|
descriptionLog: z.string().optional(),
|
|
server: z.boolean().optional(),
|
|
type: z.enum(["deploy", "redeploy"]),
|
|
applicationType: z.literal("application"),
|
|
serverId: z.string().min(1),
|
|
}),
|
|
z.object({
|
|
composeId: z.string(),
|
|
titleLog: z.string().optional(),
|
|
descriptionLog: z.string().optional(),
|
|
server: z.boolean().optional(),
|
|
type: z.enum(["deploy", "redeploy"]),
|
|
applicationType: z.literal("compose"),
|
|
serverId: z.string().min(1),
|
|
}),
|
|
z.object({
|
|
applicationId: z.string(),
|
|
previewDeploymentId: z.string(),
|
|
titleLog: z.string().optional(),
|
|
descriptionLog: z.string().optional(),
|
|
server: z.boolean().optional(),
|
|
type: z.enum(["deploy"]),
|
|
applicationType: z.literal("application-preview"),
|
|
serverId: z.string().min(1),
|
|
}),
|
|
]);
|
|
|
|
export type DeployJob = z.infer<typeof deployJobSchema>;
|
|
|
|
export const cancelDeploymentSchema = z.discriminatedUnion("applicationType", [
|
|
z.object({
|
|
applicationId: z.string(),
|
|
applicationType: z.literal("application"),
|
|
}),
|
|
z.object({
|
|
composeId: z.string(),
|
|
applicationType: z.literal("compose"),
|
|
}),
|
|
]);
|
|
|
|
export type CancelDeploymentJob = z.infer<typeof cancelDeploymentSchema>;
|