@connect-plus-online/ogabai-integrations 0.0.34 → 0.0.36

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.
package/dist/index.cjs.js CHANGED
@@ -175,6 +175,22 @@ function gqlQueryStringBuilder(query, nestedValues) {
175
175
 
176
176
  // src/services/user/schemas/user.schema.ts
177
177
  var userSchema = {
178
+ // admin dashboard stats
179
+ getUserTypeCounts: (query) => `
180
+ query getUserTypeCounts {
181
+ getUserTypeCounts {
182
+ ${query}
183
+ }
184
+ }
185
+ `,
186
+ getMonthlyUserStatsByYear: (query) => `
187
+ query getMonthlyUserStatsByYear($year: Int!) {
188
+ getMonthlyUserStatsByYear(year: $year) {
189
+ ${query}
190
+ }
191
+ }
192
+ `,
193
+ // mobile dashboard stats
178
194
  getUserDashStats: (query) => `
179
195
  query getUserDashStats {
180
196
  getUserDashStats {
@@ -214,6 +230,16 @@ var userSchema = {
214
230
  var user_schema_default = userSchema;
215
231
 
216
232
  // src/services/user/user.entity.ts
233
+ var userTypeCountsQuery = [
234
+ "customers",
235
+ "distributors",
236
+ "manufacturer",
237
+ "total"
238
+ ];
239
+ var monthlyUserStatQuery = [
240
+ "month",
241
+ "total"
242
+ ];
217
243
  var notificationQuery = [
218
244
  "createdAt",
219
245
  "description",
@@ -303,6 +329,11 @@ var userSettingQuery = [
303
329
  ];
304
330
 
305
331
  // src/services/inventory/entities.ts
332
+ var customersProductCountQuery = [
333
+ "count",
334
+ "storeId",
335
+ "userId"
336
+ ];
306
337
  var storeCategoryProductQuery = [
307
338
  "_id",
308
339
  "createdAt",
@@ -411,6 +442,18 @@ var getAccountResponseNestedFields = {
411
442
  };
412
443
 
413
444
  // src/services/user/types/user.type.ts
445
+ var getUserTypeCountsResponse = [
446
+ "userTypeCounts"
447
+ ];
448
+ var getUserTypeCountsResponseNestedFields = {
449
+ userTypeCounts: userTypeCountsQuery
450
+ };
451
+ var getMonthlyUserStatsByYearResponse = [
452
+ "monthlyUserStat"
453
+ ];
454
+ var getMonthlyUserStatsByYearResponseNestedFields = {
455
+ monthlyUserStat: monthlyUserStatQuery
456
+ };
414
457
  var getUserDashStatsResponse = [
415
458
  "outOfStockCount",
416
459
  "productCounts",
@@ -465,6 +508,36 @@ var meResponseNestedFields = {
465
508
 
466
509
  // src/services/user/user.service.ts
467
510
  var createUserService = (client) => ({
511
+ // admin dashboard stats
512
+ async getUserTypeCounts(fetchFields, option) {
513
+ var _a, _b, _c;
514
+ const res = await client.request(
515
+ user_schema_default.getUserTypeCounts(
516
+ gqlQueryStringBuilder(
517
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getUserTypeCountsResponse,
518
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getUserTypeCountsResponseNestedFields
519
+ )
520
+ ),
521
+ {},
522
+ option
523
+ );
524
+ return (_c = res.data) == null ? void 0 : _c.getUserTypeCounts;
525
+ },
526
+ async getMonthlyUserStatsByYear(input, fetchFields, option) {
527
+ var _a, _b, _c;
528
+ const res = await client.request(
529
+ user_schema_default.getMonthlyUserStatsByYear(
530
+ gqlQueryStringBuilder(
531
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getMonthlyUserStatsByYearResponse,
532
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getMonthlyUserStatsByYearResponseNestedFields
533
+ )
534
+ ),
535
+ input,
536
+ option
537
+ );
538
+ return (_c = res.data) == null ? void 0 : _c.getMonthlyUserStatsByYear;
539
+ },
540
+ // user dashboard stats
468
541
  async getUserDashStats(fetchFields, option) {
469
542
  var _a, _b, _c;
470
543
  const res = await client.request(
@@ -760,6 +833,12 @@ var createUserNotificationService = (client) => ({
760
833
  });
761
834
 
762
835
  // src/services/inventory/types/product.type.ts
836
+ var getCustomerProductCountsByIdsResponse = [
837
+ "customersProductCounts"
838
+ ];
839
+ var getCustomerProductCountsByIdsResponseNestedFields = {
840
+ customersProductCounts: customersProductCountQuery
841
+ };
763
842
  var getProductResponseFields = [
764
843
  "product"
765
844
  ];
@@ -1218,6 +1297,13 @@ var createPriceService = (client) => ({
1218
1297
 
1219
1298
  // src/services/inventory/schema/product.schema.ts
1220
1299
  var productSchema = {
1300
+ getCustomerProductCountsByIds: (query) => `
1301
+ query getCustomerProductCountsByIds($userIds: [String]!) {
1302
+ getCustomerProductCountsByIds(userIds: $userIds) {
1303
+ ${query}
1304
+ }
1305
+ }
1306
+ `,
1221
1307
  searchCategoriesAndTemplate: (query) => `
1222
1308
  query searchCategoriesAndTemplate($search: String, $shouldGetFromAllStores: Boolean){
1223
1309
  searchCategoriesAndTemplate(search: $search, shouldGetFromAllStores: $shouldGetFromAllStores) {
@@ -1306,6 +1392,20 @@ var createProductService = (client) => ({
1306
1392
  const fileClient = createFileService(client);
1307
1393
  return (await fileClient.uploadFile(form)).product;
1308
1394
  },
1395
+ async getCustomerProductCountsByIds(input, fetchFields, option) {
1396
+ var _a, _b, _c, _d;
1397
+ const res = await client.request(
1398
+ productSchema.getCustomerProductCountsByIds(
1399
+ gqlQueryStringBuilder(
1400
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getCustomerProductCountsByIdsResponse,
1401
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getCustomerProductCountsByIdsResponseNestedFields
1402
+ )
1403
+ ),
1404
+ input,
1405
+ option
1406
+ );
1407
+ return (_d = (_c = res.data) == null ? void 0 : _c.getCustomerProductCountsByIds) != null ? _d : null;
1408
+ },
1309
1409
  async searchCategoriesAndTemplate(input, fetchFields, option) {
1310
1410
  var _a, _b, _c, _d;
1311
1411
  const res = await client.request(
@@ -2244,6 +2344,8 @@ exports.createTransactionService = createTransactionService;
2244
2344
  exports.createTransport = createTransport;
2245
2345
  exports.createUserNotificationService = createUserNotificationService;
2246
2346
  exports.createUserService = createUserService;
2347
+ exports.getCustomerProductCountsByIdsResponse = getCustomerProductCountsByIdsResponse;
2348
+ exports.getCustomerProductCountsByIdsResponseNestedFields = getCustomerProductCountsByIdsResponseNestedFields;
2247
2349
  exports.getOrderResponse = getOrderResponse;
2248
2350
  exports.getOrderResponseNestedFields = getOrderResponseNestedFields;
2249
2351
  exports.getOrdersResponse = getOrdersResponse;