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,
|
deployer: deployment.deployer,
|
||||||
isDNS: true,
|
isDNS: true,
|
||||||
isCurrent: true,
|
isCurrent: true,
|
||||||
|
},
|
||||||
|
relations: {
|
||||||
|
project: true,
|
||||||
|
deployer: true,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (oldDNSDeployment) {
|
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);
|
await this.db.deleteDeploymentById(oldDNSDeployment.id);
|
||||||
|
|
||||||
// Update domain after the previous DNS deployment is deleted due to unique key constraint for domain
|
// 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
|
// Set the domain for the new current DNS deployment to the custom domain that was added for that project
|
||||||
// Or to the custom domain that was added for that project
|
const domain = await this.db.getOldestDomainByProjectId(deployment.project.id);
|
||||||
const domain = oldDNSDeployment.domain
|
|
||||||
|| await this.db.getOldestDomainByProjectId(deployment.project.id);
|
|
||||||
|
|
||||||
if (domain) {
|
if (domain) {
|
||||||
await this.db.updateDeploymentById(deployment.id, { domain });
|
await this.db.updateDeploymentById(deployment.id, { domain });
|
||||||
|
Loading…
Reference in New Issue
Block a user