Update method to rollback to previous version
All checks were successful
Lint / lint (20.x) (pull_request) Successful in 4m38s

This commit is contained in:
IshaVenikar 2025-02-04 17:36:45 +05:30
parent 720411d5d2
commit 21334df4cb

View File

@ -695,8 +695,8 @@ export class Service {
// If a custom domain is present then use that as the DNS in the deployment request // If a custom domain is present then use that as the DNS in the deployment request
const customDomain = await this.db.getOldestDomainByProjectId(data.project!.id!); const customDomain = await this.db.getOldestDomainByProjectId(data.project!.id!);
// On deleting deployment later, project DNS deployment is also deleted // On deleting deployment later, project canonical deployment is also deleted
// So publish project DNS deployment first so that ApplicationDeploymentRecord for the same is available when deleting deployment later // So publish project canonical deployment first so that ApplicationDeploymentRecord for the same is available when deleting deployment later
const { applicationDeploymentRequestData, applicationDeploymentRequestId } = const { applicationDeploymentRequestData, applicationDeploymentRequestId } =
await this.laconicRegistry.createApplicationDeploymentRequest({ await this.laconicRegistry.createApplicationDeploymentRequest({
deployment: canonicalDeployment, deployment: canonicalDeployment,
@ -791,8 +791,8 @@ export class Service {
// If a custom domain is present then use that as the DNS in the deployment request // If a custom domain is present then use that as the DNS in the deployment request
const customDomain = await this.db.getOldestDomainByProjectId(project!.id!); const customDomain = await this.db.getOldestDomainByProjectId(project!.id!);
// On deleting deployment later, project DNS deployment is also deleted // On deleting deployment later, project canonical deployment is also deleted
// So publish project DNS deployment first so that ApplicationDeploymentRecord for the same is available when deleting deployment later // So publish project canonical deployment first so that ApplicationDeploymentRecord for the same is available when deleting deployment later
const { applicationDeploymentRequestId, applicationDeploymentRequestData } = const { applicationDeploymentRequestId, applicationDeploymentRequestData } =
await this.laconicRegistry.createApplicationDeploymentRequest({ await this.laconicRegistry.createApplicationDeploymentRequest({
deployment: canonicalDeployment, deployment: canonicalDeployment,
@ -1218,6 +1218,10 @@ export class Service {
{ isCurrent: true }, { isCurrent: true },
); );
if (!newCurrentDeploymentUpdate || !oldCurrentDeploymentUpdate){
return false;
}
const newCurrentDeployment = await this.db.getDeployment({ where: { id: deploymentId }, relations: { project: true, deployer: true } }); const newCurrentDeployment = await this.db.getDeployment({ where: { id: deploymentId }, relations: { project: true, deployer: true } });
if (!newCurrentDeployment) { if (!newCurrentDeployment) {
@ -1255,12 +1259,12 @@ export class Service {
log(`Application deployment request record published: ${result.id}`) log(`Application deployment request record published: ${result.id}`)
await this.db.updateDeploymentById(canonicalDeployment.id, { const updateResult = await this.db.updateDeploymentById(canonicalDeployment.id, {
applicationDeploymentRequestId: result.id, applicationDeploymentRequestId: result.id,
applicationDeploymentRequestData, applicationDeploymentRequestData,
}); });
return newCurrentDeploymentUpdate && oldCurrentDeploymentUpdate; return updateResult;
} }
async deleteDeployment(deploymentId: string): Promise<boolean> { async deleteDeployment(deploymentId: string): Promise<boolean> {