refactor(patch): unify patch retrieval and application logic

- Consolidated patch retrieval for applications and composes into a single query method, improving code clarity and reducing redundancy.
- Updated the ShowPatches component to utilize the new unified query, simplifying data fetching logic.
- Refactored patch application commands to streamline the process for both application and compose types, enhancing maintainability and consistency across the codebase.
This commit is contained in:
Mauricio Siu
2026-02-17 01:35:08 -06:00
parent 9818e3c3ba
commit 46ac272f3f
5 changed files with 86 additions and 168 deletions
+6 -17
View File
@@ -44,10 +44,7 @@ import {
issueCommentExists,
updateIssueComment,
} from "./github";
import {
findPatchesByApplicationId,
generateApplyPatchesCommand,
} from "./patch";
import { generateApplyPatchesCommand } from "./patch";
import {
findPreviewDeploymentById,
updatePreviewDeployment,
@@ -206,20 +203,12 @@ export const deployApplication = async ({
command += await buildRemoteDocker(application);
}
// Apply patches after cloning (for non-docker sources only)
if (application.sourceType !== "docker") {
const patches = await findPatchesByApplicationId(
application.applicationId,
);
const enabledPatches = patches.filter((p) => p.enabled);
if (enabledPatches.length > 0) {
command += generateApplyPatchesCommand({
appName: application.appName,
type: "application",
serverId,
patches: enabledPatches,
});
}
command += await generateApplyPatchesCommand({
id: application.applicationId,
type: "application",
serverId,
});
}
command += await getBuildCommand(application);