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 })
|
||||
isCurrent!: boolean;
|
||||
|
||||
|
||||
// TODO: Rename field
|
||||
@Column('boolean', { default: false })
|
||||
isDNS!: boolean;
|
||||
|
@ -382,7 +382,7 @@ export class Registry {
|
||||
true
|
||||
);
|
||||
|
||||
// Filter records with ApplicationDeploymentRequestId ID and Deployment specific URL
|
||||
// Filter records with ApplicationDeploymentRequestId ID
|
||||
return records.filter((record: AppDeploymentRecord) =>
|
||||
deployments.some(
|
||||
(deployment) =>
|
||||
|
@ -221,7 +221,6 @@ export class Service {
|
||||
deployment.dnsRecordData = dnsRecordData;
|
||||
|
||||
if (deployment.isDNS) {
|
||||
// Delete previous DNS deployment
|
||||
const oldDNSDeployment = await this.db.getDeployment({
|
||||
where: {
|
||||
projectId: deployment.project.id,
|
||||
@ -231,11 +230,21 @@ export class Service {
|
||||
}
|
||||
});
|
||||
|
||||
if (oldDNSDeployment) {
|
||||
await this.db.deleteDeploymentById(oldDNSDeployment.id);
|
||||
if (oldDNSDeployment.domain) {
|
||||
await this.db.updateDeploymentById(deployment.id, { domain: oldDNSDeployment.domain })
|
||||
}
|
||||
if (!oldDNSDeployment) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 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(
|
||||
deployment.projectId,
|
||||
);
|
||||
|
||||
const oldDeployments = projectDeployments.filter(
|
||||
(projectDeployment) =>
|
||||
projectDeployment.deployer.deployerLrn ===
|
||||
@ -714,7 +724,6 @@ export class Service {
|
||||
await this.db.updateDeploymentById(dnsDeployment.id, {
|
||||
applicationDeploymentRequestId,
|
||||
applicationDeploymentRequestData,
|
||||
domainId: domain?.id ?? null
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user