feat(gql): deployment removal request

This commit is contained in:
Eric Lewis 2024-03-27 12:54:34 -04:00 committed by Nabarun
parent 3cbea57294
commit 953c3fc10b
4 changed files with 22 additions and 2 deletions

View File

@ -232,7 +232,7 @@ export class Registry {
}
async createApplicationDeploymentRemovalRequest (data: {
deployment: Deployment
deploymentId: string;
}): Promise<{
applicationDeploymentRemovalRequestId: string;
applicationDeploymentRemovalRequestData: ApplicationDeploymentRemovalRequest;
@ -240,7 +240,7 @@ export class Registry {
const applicationDeploymentRemovalRequest = {
type: APP_DEPLOYMENT_REMOVAL_REQUEST_TYPE,
version: '1.0.0',
deployment: data.deployment.id
deployment: data.deploymentId
};
const result = await this.registry.setRecord(

View File

@ -255,6 +255,20 @@ export const createResolvers = async (service: Service): Promise<any> => {
}
},
deleteDeployment: async (
_: any,
{
deploymentId
}: { deploymentId: string; }
) => {
try {
return await service.deleteDeployment(deploymentId);
} catch (err) {
log(err);
return false;
}
},
addDomain: async (
_: any,
{ projectId, data }: { projectId: string; data: { name: string } }

View File

@ -209,6 +209,7 @@ type Mutation {
deleteProject(projectId: String!): Boolean!
deleteDomain(domainId: String!): Boolean!
rollbackDeployment(projectId: String!, deploymentId: String!): Boolean!
deleteDeployment(deploymentId: String!): Boolean!
addDomain(projectId: String!, data: AddDomainInput!): Boolean!
updateDomain(domainId: String!, data: UpdateDomainInput!): Boolean!
authenticateGitHub(code: String!): AuthResult!

View File

@ -694,6 +694,11 @@ export class Service {
return newCurrentDeploymentUpdate && oldCurrentDeploymentUpdate;
}
async deleteDeployment (deploymentId: string): Promise<boolean> {
const result = await this.registry.createApplicationDeploymentRemovalRequest({ deploymentId });
return (result !== undefined || result !== null);
}
async addDomain (
projectId: string,
data: { name: string }