forked from cerc-io/snowballtools-base
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:
committed by
Ashwin Phatak
co-authored by
neeraj
parent
44310d4eb8
commit
2fb048e8ab
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,3 +11,9 @@ mutation ($projectId: String!, $environmentVariables: [AddEnvironmentVariableInp
|
||||
addEnvironmentVariables(projectId: $projectId, environmentVariables: $environmentVariables)
|
||||
}
|
||||
`;
|
||||
|
||||
export const updateDeploymentToProd = gql`
|
||||
mutation ($deploymentId: String!) {
|
||||
updateDeploymentToProd(deploymentId: $deploymentId)
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -165,3 +165,7 @@ export type AddEnvironmentVariableInput = {
|
||||
key: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export type UpdateDeploymentToProdResponse = {
|
||||
updateDeploymentToProd: boolean;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user