diff --git a/packages/backend/src/registry.ts b/packages/backend/src/registry.ts index 71091f1e..6e9f8966 100644 --- a/packages/backend/src/registry.ts +++ b/packages/backend/src/registry.ts @@ -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( diff --git a/packages/backend/src/resolvers.ts b/packages/backend/src/resolvers.ts index e2e3339d..5e40c74a 100644 --- a/packages/backend/src/resolvers.ts +++ b/packages/backend/src/resolvers.ts @@ -255,6 +255,20 @@ export const createResolvers = async (service: Service): Promise => { } }, + 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 } } diff --git a/packages/backend/src/schema.gql b/packages/backend/src/schema.gql index c22db8db..5ba963c8 100644 --- a/packages/backend/src/schema.gql +++ b/packages/backend/src/schema.gql @@ -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! diff --git a/packages/backend/src/service.ts b/packages/backend/src/service.ts index 5211585c..daa86c40 100644 --- a/packages/backend/src/service.ts +++ b/packages/backend/src/service.ts @@ -694,6 +694,11 @@ export class Service { return newCurrentDeploymentUpdate && oldCurrentDeploymentUpdate; } + async deleteDeployment (deploymentId: string): Promise { + const result = await this.registry.createApplicationDeploymentRemovalRequest({ deploymentId }); + return (result !== undefined || result !== null); + } + async addDomain ( projectId: string, data: { name: string }