Send DNS deployment removal request on changing custom domain
This commit is contained in:
parent
ce56a4dc29
commit
d1e6171874
@ -234,18 +234,29 @@ export class Service {
|
||||
deployer: deployment.deployer,
|
||||
isDNS: true,
|
||||
isCurrent: true,
|
||||
},
|
||||
relations: {
|
||||
project: true,
|
||||
deployer: true,
|
||||
}
|
||||
});
|
||||
|
||||
if (oldDNSDeployment) {
|
||||
// Delete previous DNS deployment
|
||||
// Send removal request for the previous DNS deployment and delete DB entry
|
||||
if (oldDNSDeployment.url === deployment.url) {
|
||||
await this.laconicRegistry.createApplicationDeploymentRemovalRequest({
|
||||
deploymentId: oldDNSDeployment.applicationDeploymentRecordId!,
|
||||
deployerLrn: oldDNSDeployment.deployer.deployerLrn,
|
||||
auctionId: oldDNSDeployment.project.auctionId,
|
||||
payment: oldDNSDeployment.project.txHash
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
// Set the domain for the new current DNS deployment to the custom domain that was added for that project
|
||||
const domain = await this.db.getOldestDomainByProjectId(deployment.project.id);
|
||||
|
||||
if (domain) {
|
||||
await this.db.updateDeploymentById(deployment.id, { domain });
|
||||
|
Loading…
Reference in New Issue
Block a user