@longvansoftware/service-js-client 1.5.4 → 1.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,7 +25,7 @@ exports.environmentEndpoints = {
25
25
  auth: "https://crm.longvan.vn/authorization-gateway/graphql",
26
26
  order: "https://storefront.longvan.vn/v2",
27
27
  user: "https://user.longvan.vn/user-gateway/graphql",
28
- payment: "https://portal-staging.longvan.vn/invoice-gateway/graphql",
28
+ payment: "https://portal.longvan.vn/invoice-gateway/graphql",
29
29
  service: "https://portal.longvan.vn/service-api/graphql",
30
30
  warehouse: "https://facility-api-v2.longvan.vn/facility-api/public-facility/1.0.0",
31
31
  computing: "https://api-gateway.longvan.vn/computing-service/graphql",
@@ -5,3 +5,7 @@ export declare const CREATE_CUSTOMER_V2: import("graphql").DocumentNode;
5
5
  export declare const CREATE_VAT_INFO: import("graphql").DocumentNode;
6
6
  export declare const UPDATE_VAT_INFO: import("graphql").DocumentNode;
7
7
  export declare const DELETE_VAT_INFO: import("graphql").DocumentNode;
8
+ export declare const CREATE_TEAM: import("graphql").DocumentNode;
9
+ export declare const ADD_USER_TO_TEAM: import("graphql").DocumentNode;
10
+ export declare const REMOVE_USER_FROM_TEAM: import("graphql").DocumentNode;
11
+ export declare const UPDATE_TEAM_NAME: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DELETE_VAT_INFO = exports.UPDATE_VAT_INFO = exports.CREATE_VAT_INFO = exports.CREATE_CUSTOMER_V2 = exports.UPDATE_CUSTOMER_V2 = exports.UPDATE_COMPANY_INFOR = exports.CREATE_COMPANY = void 0;
3
+ exports.UPDATE_TEAM_NAME = exports.REMOVE_USER_FROM_TEAM = exports.ADD_USER_TO_TEAM = exports.CREATE_TEAM = exports.DELETE_VAT_INFO = exports.UPDATE_VAT_INFO = exports.CREATE_VAT_INFO = exports.CREATE_CUSTOMER_V2 = exports.UPDATE_CUSTOMER_V2 = exports.UPDATE_COMPANY_INFOR = exports.CREATE_COMPANY = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.CREATE_COMPANY = (0, graphql_tag_1.gql) `
6
6
  mutation CreateCompany(
@@ -169,3 +169,61 @@ exports.DELETE_VAT_INFO = (0, graphql_tag_1.gql) `
169
169
  deleteVatInfo(id: $id, updatedBy: $updatedBy)
170
170
  }
171
171
  `;
172
+ exports.CREATE_TEAM = (0, graphql_tag_1.gql) `
173
+ mutation CreateTeam(
174
+ $name: String!
175
+ $partnerId: String!
176
+ $createdBy: String!
177
+ ) {
178
+ createTeam(name: $name, partnerId: $partnerId, createdBy: $createdBy) {
179
+ id
180
+ name
181
+ createdStamp
182
+ createdBy
183
+ }
184
+ }
185
+ `;
186
+ exports.ADD_USER_TO_TEAM = (0, graphql_tag_1.gql) `
187
+ mutation addUserToTeam(
188
+ $teamId: String!
189
+ $userId: String!
190
+ $partnerId: String!
191
+ $createdBy: String!
192
+ ) {
193
+ addUserToTeam(
194
+ teamId: $teamId
195
+ userId: $userId
196
+ partnerId: $partnerId
197
+ createdBy: $createdBy
198
+ )
199
+ }
200
+ `;
201
+ exports.REMOVE_USER_FROM_TEAM = (0, graphql_tag_1.gql) `
202
+ mutation removeUserFromTeam(
203
+ $teamId: String!
204
+ $userId: String!
205
+ $partnerId: String!
206
+ $deletedBy: String!
207
+ ) {
208
+ removeUserFromTeam(
209
+ teamId: $teamId
210
+ userId: $userId
211
+ partnerId: $partnerId
212
+ deletedBy: $deletedBy
213
+ )
214
+ }
215
+ `;
216
+ exports.UPDATE_TEAM_NAME = (0, graphql_tag_1.gql) `
217
+ mutation updateTeamName(
218
+ $teamId: String!
219
+ $name: String!
220
+ $updatedBy: String!
221
+ ) {
222
+ updateTeamName(teamId: $teamId, name: $name, updatedBy: $updatedBy) {
223
+ id
224
+ name
225
+ createdStamp
226
+ createdBy
227
+ }
228
+ }
229
+ `;
@@ -12,3 +12,5 @@ export declare const GET_PROVINCES: import("graphql").DocumentNode;
12
12
  export declare const GET_DISTRICTS: import("graphql").DocumentNode;
13
13
  export declare const GET_WARDS: import("graphql").DocumentNode;
14
14
  export declare const GET_VAT_INFOR_BY_OWNER_PARTY_ID: import("graphql").DocumentNode;
15
+ export declare const GET_TEAM_BY_USER_ID: import("graphql").DocumentNode;
16
+ export declare const GET_USERS_BY_TEAM_ID: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GET_VAT_INFOR_BY_OWNER_PARTY_ID = exports.GET_WARDS = exports.GET_DISTRICTS = exports.GET_PROVINCES = exports.GET_CONTACT_INFOS_BY_COMPANY_ID = exports.GET_COMPANY_BY_CONTACT_INFO_ID = exports.GET_EMPLOYEES_BY_STORE_CHANEL_ID = exports.GET_STORE_CHANEL_IDS_BY_EMPLOYESS_ID = exports.GET_POSTIONS_BY_EMPLOYEES_ID = exports.SEARCH_EMPLOYEES = exports.SEARCH_CUSTOMER = exports.GET_CUSTOMER_BY_ID = exports.SEARCH_COMPANY = exports.GET_PERSON_BY_IDS_QUERY = void 0;
3
+ exports.GET_USERS_BY_TEAM_ID = exports.GET_TEAM_BY_USER_ID = exports.GET_VAT_INFOR_BY_OWNER_PARTY_ID = exports.GET_WARDS = exports.GET_DISTRICTS = exports.GET_PROVINCES = exports.GET_CONTACT_INFOS_BY_COMPANY_ID = exports.GET_COMPANY_BY_CONTACT_INFO_ID = exports.GET_EMPLOYEES_BY_STORE_CHANEL_ID = exports.GET_STORE_CHANEL_IDS_BY_EMPLOYESS_ID = exports.GET_POSTIONS_BY_EMPLOYEES_ID = exports.SEARCH_EMPLOYEES = exports.SEARCH_CUSTOMER = exports.GET_CUSTOMER_BY_ID = exports.SEARCH_COMPANY = exports.GET_PERSON_BY_IDS_QUERY = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.GET_PERSON_BY_IDS_QUERY = (0, graphql_tag_1.gql) `
6
6
  query GetPersonByIds($partyIds: [String!]!) {
@@ -283,3 +283,30 @@ exports.GET_VAT_INFOR_BY_OWNER_PARTY_ID = (0, graphql_tag_1.gql) `
283
283
  }
284
284
  }
285
285
  `;
286
+ exports.GET_TEAM_BY_USER_ID = (0, graphql_tag_1.gql) `
287
+ query getTeamByUserId($userId: String!, $partnerId: String!) {
288
+ getTeamByUserId(userId: $userId, partnerId: $partnerId) {
289
+ id
290
+ name
291
+ createdStamp
292
+ createdBy
293
+ }
294
+ }
295
+ `;
296
+ exports.GET_USERS_BY_TEAM_ID = (0, graphql_tag_1.gql) `
297
+ query getUsersByTeamId($teamId: String!) {
298
+ getUsersByTeamId(teamId: $teamId) {
299
+ id
300
+ name
301
+ address
302
+ gender
303
+ identityNumber
304
+ birthDate
305
+ email
306
+ phone
307
+ createdStamp
308
+ createdBy
309
+ memberLevel
310
+ }
311
+ }
312
+ `;
@@ -26,4 +26,10 @@ export declare class UserService extends Service {
26
26
  createVatInfo(createVatInfoRequest: any, createdBy: string): Promise<any>;
27
27
  updateVatInfo(id: string, updateVatInfoRequest: any, updateBy: string): Promise<any>;
28
28
  deleteVatInfo(id: string, updatedBy: string): Promise<any>;
29
+ createTeam(name: string, createdBy: string): Promise<any>;
30
+ getTeamByUserId(userId: string): Promise<any>;
31
+ getUsersByTeamId(teamId: string): Promise<any>;
32
+ addUserToTeam(teamId: string, userId: string, createdBy: string): Promise<any>;
33
+ removeUserFromTeam(teamId: string, userId: string, deletedBy: string): Promise<any>;
34
+ updateTeamName(teamId: string, name: string, updatedBy: string): Promise<any>;
29
35
  }
@@ -415,5 +415,112 @@ class UserService extends serviceSDK_1.Service {
415
415
  }
416
416
  });
417
417
  }
418
+ createTeam(name, createdBy) {
419
+ return __awaiter(this, void 0, void 0, function* () {
420
+ const mutation = mutations_1.CREATE_TEAM;
421
+ const variables = {
422
+ name,
423
+ partnerId: this.orgId,
424
+ createdBy,
425
+ };
426
+ try {
427
+ const response = yield this.graphqlMutation(mutation, variables);
428
+ return response.createTeam;
429
+ }
430
+ catch (error) {
431
+ console.log(`Error in createTeam: ${error}`);
432
+ throw error;
433
+ }
434
+ });
435
+ }
436
+ getTeamByUserId(userId) {
437
+ return __awaiter(this, void 0, void 0, function* () {
438
+ const query = queries_1.GET_TEAM_BY_USER_ID;
439
+ const variables = {
440
+ userId,
441
+ partnerId: this.orgId,
442
+ };
443
+ try {
444
+ const response = yield this.graphqlQuery(query, variables);
445
+ return response.getTeamByUserId;
446
+ }
447
+ catch (error) {
448
+ console.log(`Error in getTeamByUserId: ${error}`);
449
+ throw error;
450
+ }
451
+ });
452
+ }
453
+ getUsersByTeamId(teamId) {
454
+ return __awaiter(this, void 0, void 0, function* () {
455
+ const query = queries_1.GET_USERS_BY_TEAM_ID;
456
+ const variables = {
457
+ teamId,
458
+ };
459
+ try {
460
+ const response = yield this.graphqlQuery(query, variables);
461
+ return response.getUsersByTeamId;
462
+ }
463
+ catch (error) {
464
+ console.log(`Error in getUsersByTeamId: ${error}`);
465
+ throw error;
466
+ }
467
+ });
468
+ }
469
+ addUserToTeam(teamId, userId, createdBy) {
470
+ return __awaiter(this, void 0, void 0, function* () {
471
+ const query = mutations_1.ADD_USER_TO_TEAM;
472
+ const variables = {
473
+ teamId,
474
+ userId,
475
+ partnerId: this.orgId,
476
+ createdBy,
477
+ };
478
+ try {
479
+ const response = yield this.graphqlMutation(query, variables);
480
+ return response.addUserToTeam;
481
+ }
482
+ catch (error) {
483
+ console.log(`Error in addUserToTeam: ${error}`);
484
+ throw error;
485
+ }
486
+ });
487
+ }
488
+ removeUserFromTeam(teamId, userId, deletedBy) {
489
+ return __awaiter(this, void 0, void 0, function* () {
490
+ const query = mutations_1.REMOVE_USER_FROM_TEAM;
491
+ const variables = {
492
+ teamId,
493
+ userId,
494
+ partnerId: this.orgId,
495
+ deletedBy,
496
+ };
497
+ try {
498
+ const response = yield this.graphqlMutation(query, variables);
499
+ return response.removeUserFromTeam;
500
+ }
501
+ catch (error) {
502
+ console.log(`Error in removeUserFromTeam: ${error}`);
503
+ throw error;
504
+ }
505
+ });
506
+ }
507
+ updateTeamName(teamId, name, updatedBy) {
508
+ return __awaiter(this, void 0, void 0, function* () {
509
+ const query = mutations_1.UPDATE_TEAM_NAME;
510
+ const variables = {
511
+ teamId,
512
+ name,
513
+ updatedBy,
514
+ };
515
+ try {
516
+ const response = yield this.graphqlMutation(query, variables);
517
+ return response.updateTeamName;
518
+ }
519
+ catch (error) {
520
+ console.log(`Error in updateTeamName: ${error}`);
521
+ throw error;
522
+ }
523
+ });
524
+ }
418
525
  }
419
526
  exports.UserService = UserService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/service-js-client",
3
- "version": "1.5.4",
3
+ "version": "1.5.5",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [