mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-04 05:25:22 +02:00
refactor(deployments): unify old deployment clearing logic for applications and composes
- Renamed and consolidated the functions for clearing old deployments to a single method, `clearOldDeployments`, which now accepts an ID and type (application or compose). - Updated the logic to filter deployments based on status and type, improving code maintainability and reducing redundancy.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
addNewService,
|
||||
checkServiceAccess,
|
||||
clearOldDeploymentsByApplicationId,
|
||||
clearOldDeployments,
|
||||
createApplication,
|
||||
deleteAllMiddlewares,
|
||||
findApplicationById,
|
||||
@@ -761,9 +761,7 @@ export const applicationRouter = createTRPCRouter({
|
||||
"You are not authorized to clear deployments for this application",
|
||||
});
|
||||
}
|
||||
const result = await clearOldDeploymentsByApplicationId(
|
||||
input.applicationId,
|
||||
);
|
||||
const result = await clearOldDeployments(input.applicationId);
|
||||
return {
|
||||
success: true,
|
||||
message: `${result.deletedCount} old deployments cleared successfully`,
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
addDomainToCompose,
|
||||
addNewService,
|
||||
checkServiceAccess,
|
||||
clearOldDeploymentsByComposeId,
|
||||
clearOldDeployments,
|
||||
cloneCompose,
|
||||
createCommand,
|
||||
createCompose,
|
||||
@@ -278,7 +278,7 @@ export const composeRouter = createTRPCRouter({
|
||||
"You are not authorized to clear deployments for this compose",
|
||||
});
|
||||
}
|
||||
const result = await clearOldDeploymentsByComposeId(input.composeId);
|
||||
const result = await clearOldDeployments(input.composeId, "compose");
|
||||
return {
|
||||
success: true,
|
||||
message: `${result.deletedCount} old deployments cleared successfully`,
|
||||
|
||||
Reference in New Issue
Block a user