Refactor mutation GQL methods to service class and display organization name (#53)

* Refactor mutation methods to service class

* Refactor database methods to service class

* Display organization name in sidebar

* Handle review comments

---------

Co-authored-by: neeraj <neeraj.rtly@gmail.com>
This commit is contained in:
2024-02-05 16:21:55 +05:30
committed by GitHub
co-authored by neeraj
parent ac7064afa5
commit da92ddfba3
10 changed files with 320 additions and 218 deletions
+8 -8
View File
@@ -148,28 +148,28 @@ export class GQLClient {
return data;
}
async addEnvironmentVariables (projectId: string, environmentVariables: AddEnvironmentVariableInput[]): Promise<AddEnvironmentVariablesResponse> {
const { data } = await this.client.mutate({
async addEnvironmentVariables (projectId: string, data: AddEnvironmentVariableInput[]): Promise<AddEnvironmentVariablesResponse> {
const result = await this.client.mutate({
mutation: addEnvironmentVariables,
variables: {
projectId,
environmentVariables
data
}
});
return data;
return result.data;
}
async updateEnvironmentVariable (environmentVariableId: string, environmentVariable: UpdateEnvironmentVariableInput): Promise<UpdateEnvironmentVariableResponse> {
const { data } = await this.client.mutate({
async updateEnvironmentVariable (environmentVariableId: string, data: UpdateEnvironmentVariableInput): Promise<UpdateEnvironmentVariableResponse> {
const result = await this.client.mutate({
mutation: updateEnvironmentVariable,
variables: {
environmentVariableId,
environmentVariable
data
}
});
return data;
return result.data;
}
async removeEnvironmentVariable (environmentVariableId: string): Promise<RemoveEnvironmentVariableResponse> {
+4 -4
View File
@@ -19,14 +19,14 @@ mutation ($projectId: String!, $data: AddProjectMemberInput) {
`;
export const addEnvironmentVariables = gql`
mutation ($projectId: String!, $environmentVariables: [AddEnvironmentVariableInput!]) {
addEnvironmentVariables(projectId: $projectId, environmentVariables: $environmentVariables)
mutation ($projectId: String!, $data: [AddEnvironmentVariableInput!]) {
addEnvironmentVariables(projectId: $projectId, data: $data)
}
`;
export const updateEnvironmentVariable = gql`
mutation ($environmentVariableId: String!, $environmentVariable: UpdateEnvironmentVariableInput!) {
updateEnvironmentVariable(environmentVariableId: $environmentVariableId, environmentVariable: $environmentVariable)
mutation ($environmentVariableId: String!, $data: UpdateEnvironmentVariableInput!) {
updateEnvironmentVariable(environmentVariableId: $environmentVariableId, data: $data)
}
`;