Add GQL mutation to update deployment to production (#39)

* Add mutation to update deployment to production

* Implement gql client mutation and frontend to update deployment to production

* Add toast message when deployment is changed to production

* Throw error from init db script if db aleardy exists

---------

Co-authored-by: neeraj <neeraj.rtly@gmail.com>
This commit is contained in:
2024-02-01 11:37:57 +05:30
committed by Ashwin Phatak
co-authored by neeraj
parent 44310d4eb8
commit 2fb048e8ab
12 changed files with 117 additions and 16 deletions
+13 -2
View File
@@ -1,8 +1,8 @@
import { ApolloClient, DefaultOptions, InMemoryCache, NormalizedCacheObject } from '@apollo/client';
import { getUser, getOrganizations, getDeployments, getProjectMembers, searchProjects, getEnvironmentVariables } from './queries';
import { AddEnvironmentVariableInput, AddEnvironmentVariablesResponse, GetDeploymentsResponse, GetEnvironmentVariablesResponse, GetOrganizationsResponse, GetProjectMembersResponse, SearchProjectsResponse, GetUserResponse, RemoveMemberResponse } from './types';
import { removeMember, addEnvironmentVariables } from './mutations';
import { AddEnvironmentVariableInput, AddEnvironmentVariablesResponse, GetDeploymentsResponse, GetEnvironmentVariablesResponse, GetOrganizationsResponse, GetProjectMembersResponse, SearchProjectsResponse, GetUserResponse, RemoveMemberResponse, UpdateDeploymentToProdResponse } from './types';
import { removeMember, addEnvironmentVariables, updateDeploymentToProd } from './mutations';
export interface GraphQLConfig {
gqlEndpoint: string;
@@ -113,4 +113,15 @@ export class GQLClient {
return data;
}
async updateDeploymentToProd (deploymentId: string): Promise<UpdateDeploymentToProdResponse> {
const { data } = await this.client.mutate({
mutation: updateDeploymentToProd,
variables: {
deploymentId
}
});
return data;
}
}
+6
View File
@@ -11,3 +11,9 @@ mutation ($projectId: String!, $environmentVariables: [AddEnvironmentVariableInp
addEnvironmentVariables(projectId: $projectId, environmentVariables: $environmentVariables)
}
`;
export const updateDeploymentToProd = gql`
mutation ($deploymentId: String!) {
updateDeploymentToProd(deploymentId: $deploymentId)
}
`;
+4
View File
@@ -165,3 +165,7 @@ export type AddEnvironmentVariableInput = {
key: string;
value: string;
}
export type UpdateDeploymentToProdResponse = {
updateDeploymentToProd: boolean;
}