Skip to content

Commit 2b9af3b

Browse files
committed
refactor(companies): updateCompany method parameter destructuring
1 parent a7b0d46 commit 2b9af3b

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

src/modules/companies/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
WhereCondition,
2121
OrderBy,
2222
CreatedCompanies,
23+
InputCompanyParams,
2324
} from '../../types';
2425

2526
export class Companies {
@@ -72,10 +73,10 @@ export class Companies {
7273
return response.data.createCompany as CompanyInterface;
7374
}
7475

75-
public async updateCompany(
76-
id: string,
77-
input: CompanyInput
78-
): Promise<CompanyInterface> {
76+
public async updateCompany({
77+
id,
78+
input,
79+
}: InputCompanyParams): Promise<CompanyInterface> {
7980
const response = await this.client.mutate({
8081
mutation: UPDATE_COMPANY_MUTATION,
8182
variables: { id: id, input: input },

src/mutations/companies.mutation.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const CREATE_COMPANY_MUTATION = gql`
4646
`;
4747

4848
export const UPDATE_COMPANY_MUTATION = gql`
49-
mutation updateCompany($id: ID, $input: CompanyInput) {
49+
mutation updateCompany($id: ID!, $input: CompanyInput) {
5050
updateCompany(id: $id, input: $input) {
5151
id
5252
name
@@ -61,6 +61,17 @@ export const UPDATE_COMPANY_MUTATION = gql`
6161
country_code
6262
created_at
6363
updated_at
64+
is_active
65+
total_users
66+
photo {
67+
id
68+
uuid
69+
name
70+
url
71+
type
72+
size
73+
field_name
74+
}
6475
user {
6576
id
6677
firstname
@@ -69,7 +80,6 @@ export const UPDATE_COMPANY_MUTATION = gql`
6980
}
7081
groups {
7182
id
72-
uuid
7383
name
7484
}
7585
branches {

src/types/companies.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ export interface CompanySettings {
7676
settings: any;
7777
}
7878

79+
export interface InputCompanyParams {
80+
id: number;
81+
input: CompanyInput;
82+
}
83+
7984
export interface CreatedCompanies {
8085
companies: {
8186
data: CompanyInterface[];

0 commit comments

Comments
 (0)