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: { async createApplicationDeploymentRemovalRequest (data: {
deployment: Deployment deploymentId: string;
}): Promise<{ }): Promise<{
applicationDeploymentRemovalRequestId: string; applicationDeploymentRemovalRequestId: string;
applicationDeploymentRemovalRequestData: ApplicationDeploymentRemovalRequest; applicationDeploymentRemovalRequestData: ApplicationDeploymentRemovalRequest;
@ -240,7 +240,7 @@ export class Registry {
const applicationDeploymentRemovalRequest = { const applicationDeploymentRemovalRequest = {
type: APP_DEPLOYMENT_REMOVAL_REQUEST_TYPE, type: APP_DEPLOYMENT_REMOVAL_REQUEST_TYPE,
version: '1.0.0', version: '1.0.0',
deployment: data.deployment.id deployment: data.deploymentId
}; };
const result = await this.registry.setRecord( 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 ( addDomain: async (
_: any, _: any,
{ projectId, data }: { projectId: string; data: { name: string } } { projectId, data }: { projectId: string; data: { name: string } }

View File

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

View File

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