Update comments for update deployment data flow
This commit is contained in:
parent
a16b44b43a
commit
6f32ea4da8
@ -141,7 +141,6 @@ export class Deployment {
|
|||||||
@Column('boolean', { default: false })
|
@Column('boolean', { default: false })
|
||||||
isCurrent!: boolean;
|
isCurrent!: boolean;
|
||||||
|
|
||||||
|
|
||||||
// TODO: Rename field
|
// TODO: Rename field
|
||||||
@Column('boolean', { default: false })
|
@Column('boolean', { default: false })
|
||||||
isDNS!: boolean;
|
isDNS!: boolean;
|
||||||
|
@ -382,7 +382,7 @@ export class Registry {
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
// Filter records with ApplicationDeploymentRequestId ID and Deployment specific URL
|
// Filter records with ApplicationDeploymentRequestId ID
|
||||||
return records.filter((record: AppDeploymentRecord) =>
|
return records.filter((record: AppDeploymentRecord) =>
|
||||||
deployments.some(
|
deployments.some(
|
||||||
(deployment) =>
|
(deployment) =>
|
||||||
|
@ -221,7 +221,6 @@ export class Service {
|
|||||||
deployment.dnsRecordData = dnsRecordData;
|
deployment.dnsRecordData = dnsRecordData;
|
||||||
|
|
||||||
if (deployment.isDNS) {
|
if (deployment.isDNS) {
|
||||||
// Delete previous DNS deployment
|
|
||||||
const oldDNSDeployment = await this.db.getDeployment({
|
const oldDNSDeployment = await this.db.getDeployment({
|
||||||
where: {
|
where: {
|
||||||
projectId: deployment.project.id,
|
projectId: deployment.project.id,
|
||||||
@ -231,11 +230,21 @@ export class Service {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (oldDNSDeployment) {
|
if (!oldDNSDeployment) {
|
||||||
await this.db.deleteDeploymentById(oldDNSDeployment.id);
|
return;
|
||||||
if (oldDNSDeployment.domain) {
|
|
||||||
await this.db.updateDeploymentById(deployment.id, { domain: oldDNSDeployment.domain })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete previous DNS deployment
|
||||||
|
await this.db.deleteDeploymentById(oldDNSDeployment.id);
|
||||||
|
|
||||||
|
// Update domain after the previous DNS deployment is deleted due to unique key constraint for domain
|
||||||
|
// Set the domain for the new current DNS deployment to either the domain of the previous deployment if present
|
||||||
|
// Or to the custom domain that was added for that project
|
||||||
|
const domain = oldDNSDeployment.domain
|
||||||
|
|| await this.db.getOldestDomainByProjectId(deployment.project.id);
|
||||||
|
|
||||||
|
if (domain) {
|
||||||
|
await this.db.updateDeploymentById(deployment.id, { domain });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,6 +278,7 @@ export class Service {
|
|||||||
const projectDeployments = await this.db.getDeploymentsByProjectId(
|
const projectDeployments = await this.db.getDeploymentsByProjectId(
|
||||||
deployment.projectId,
|
deployment.projectId,
|
||||||
);
|
);
|
||||||
|
|
||||||
const oldDeployments = projectDeployments.filter(
|
const oldDeployments = projectDeployments.filter(
|
||||||
(projectDeployment) =>
|
(projectDeployment) =>
|
||||||
projectDeployment.deployer.deployerLrn ===
|
projectDeployment.deployer.deployerLrn ===
|
||||||
@ -714,7 +724,6 @@ export class Service {
|
|||||||
await this.db.updateDeploymentById(dnsDeployment.id, {
|
await this.db.updateDeploymentById(dnsDeployment.id, {
|
||||||
applicationDeploymentRequestId,
|
applicationDeploymentRequestId,
|
||||||
applicationDeploymentRequestData,
|
applicationDeploymentRequestData,
|
||||||
domainId: domain?.id ?? null
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user