@zauru-sdk/graphql 2.0.195 → 2.0.204

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.
@@ -33,6 +33,7 @@ export declare const getLotsByNameStringQuery: (name: string, entity_id: number)
33
33
  export declare const getLotStocksByAgencyIdStringQuery: (agency_id: number) => string;
34
34
  export declare const getSerialsStringQuery: (filters: {
35
35
  name?: string;
36
+ id?: number | string;
36
37
  }) => string;
37
38
  export declare const getPurchaseOrdersBetweenDatesStringQuery: (startDate: string, endDate: string, config: {
38
39
  agencyId?: number | string;
@@ -148,5 +149,9 @@ export declare const getCasesStringQuery: (filters?: {
148
149
  closed?: boolean;
149
150
  tag_id?: string;
150
151
  limit?: number;
152
+ }, includes?: {
153
+ includeSerial?: boolean;
154
+ includeResponsible?: boolean;
155
+ includeSeller?: boolean;
151
156
  }) => string;
152
157
  export declare const getPrintTemplatesStringQuery = "\nquery getPrintTemplates {\n print_templates {\n id\n name\n }\n}\n";
@@ -302,6 +302,9 @@ const getSerialsStringQuery = (filters) => {
302
302
  if (filters.name) {
303
303
  conditions.push(`name: {_ilike: "%${filters.name}%"}`);
304
304
  }
305
+ if (filters.id) {
306
+ conditions.push(`id: {_eq: ${filters.id}}`);
307
+ }
305
308
  const whereClause = conditions.length
306
309
  ? `where: { ${conditions.join(", ")} }`
307
310
  : "";
@@ -320,7 +323,6 @@ const getSerialsStringQuery = (filters) => {
320
323
  agency_id
321
324
  agency_future_id
322
325
  created_at
323
- }
324
326
  }
325
327
  `;
326
328
  };
@@ -1551,7 +1553,7 @@ query getInvoicesByAgencyId {
1551
1553
  }
1552
1554
  `;
1553
1555
  exports.getInvoicesByAgencyIdStringQuery = getInvoicesByAgencyIdStringQuery;
1554
- const getCasesStringQuery = (filters) => {
1556
+ const getCasesStringQuery = (filters, includes) => {
1555
1557
  const conditions = [];
1556
1558
  if (filters?.id) {
1557
1559
  conditions.push(`id: {_eq: ${filters.id}}`);
@@ -1571,6 +1573,35 @@ const getCasesStringQuery = (filters) => {
1571
1573
  const whereClause = conditions.length
1572
1574
  ? `where: { ${conditions.join(", ")} },`
1573
1575
  : "";
1576
+ const joins = [];
1577
+ if (includes?.includeSerial) {
1578
+ joins.push(`
1579
+ serial {
1580
+ id
1581
+ id_number
1582
+ name
1583
+ description
1584
+ item_id
1585
+ entity_id
1586
+ agency_id
1587
+ agency_future_id
1588
+ created_at
1589
+ }`);
1590
+ }
1591
+ if (includes?.includeResponsible) {
1592
+ joins.push(`
1593
+ responsible {
1594
+ id
1595
+ name]
1596
+ }`);
1597
+ }
1598
+ if (includes?.includeSeller) {
1599
+ joins.push(`
1600
+ seller {
1601
+ id
1602
+ name
1603
+ }`);
1604
+ }
1574
1605
  return `query getCases {
1575
1606
  cases (${whereClause} order_by: {id: desc}, limit: ${filters?.limit || 1000})
1576
1607
  {
@@ -1594,6 +1625,7 @@ const getCasesStringQuery = (filters) => {
1594
1625
  courtesy
1595
1626
  total
1596
1627
  responsible_id
1628
+ ${joins?.join("\n") || ""}
1597
1629
  client {
1598
1630
  name
1599
1631
  tin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/graphql",
3
- "version": "2.0.195",
3
+ "version": "2.0.204",
4
4
  "description": "Queries de uso común para las aplicación de Zauru.",
5
5
  "main": "./dist/esm/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -21,5 +21,5 @@
21
21
  "devDependencies": {
22
22
  "typescript": "^5.1.6"
23
23
  },
24
- "gitHead": "73fdf74f6352667299c395e277308a9da781399a"
24
+ "gitHead": "1d4f8ef72286e9f7575109be154b09f53c3107f4"
25
25
  }