@zauru-sdk/graphql 2.0.194 → 2.0.203

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,7 @@ export declare const getCasesStringQuery: (filters?: {
148
149
  closed?: boolean;
149
150
  tag_id?: string;
150
151
  limit?: number;
152
+ }, includes?: {
153
+ includeSerial?: boolean;
151
154
  }) => string;
152
155
  export declare const getPrintTemplatesStringQuery = "\nquery getPrintTemplates {\n print_templates {\n id\n name\n }\n}\n";
@@ -193,10 +193,12 @@ const getShipmentsStringQuery = ({ agency_to_id, agency_from_id, suffix, voided,
193
193
  if (returned !== undefined) {
194
194
  conditions.push(`returned: {_eq: ${returned}}`);
195
195
  }
196
- if (plannedShippingDateRange) {
196
+ if (plannedShippingDateRange?.startDate &&
197
+ plannedShippingDateRange?.endDate) {
197
198
  conditions.push(`planned_shipping: {_gte: "${plannedShippingDateRange.startDate}", _lte: "${plannedShippingDateRange.endDate}"}`);
198
199
  }
199
- if (plannedDeliveryDateRange) {
200
+ if (plannedDeliveryDateRange?.startDate &&
201
+ plannedDeliveryDateRange?.endDate) {
200
202
  conditions.push(`planned_delivery: {_gte: "${plannedDeliveryDateRange.startDate}", _lte: "${plannedDeliveryDateRange.endDate}"}`);
201
203
  }
202
204
  const movementLots = withMovementLots
@@ -300,6 +302,9 @@ const getSerialsStringQuery = (filters) => {
300
302
  if (filters.name) {
301
303
  conditions.push(`name: {_ilike: "%${filters.name}%"}`);
302
304
  }
305
+ if (filters.id) {
306
+ conditions.push(`id: {_eq: ${filters.id}}`);
307
+ }
303
308
  const whereClause = conditions.length
304
309
  ? `where: { ${conditions.join(", ")} }`
305
310
  : "";
@@ -318,7 +323,6 @@ const getSerialsStringQuery = (filters) => {
318
323
  agency_id
319
324
  agency_future_id
320
325
  created_at
321
- }
322
326
  }
323
327
  `;
324
328
  };
@@ -1549,7 +1553,7 @@ query getInvoicesByAgencyId {
1549
1553
  }
1550
1554
  `;
1551
1555
  exports.getInvoicesByAgencyIdStringQuery = getInvoicesByAgencyIdStringQuery;
1552
- const getCasesStringQuery = (filters) => {
1556
+ const getCasesStringQuery = (filters, includes) => {
1553
1557
  const conditions = [];
1554
1558
  if (filters?.id) {
1555
1559
  conditions.push(`id: {_eq: ${filters.id}}`);
@@ -1569,6 +1573,21 @@ const getCasesStringQuery = (filters) => {
1569
1573
  const whereClause = conditions.length
1570
1574
  ? `where: { ${conditions.join(", ")} },`
1571
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
+ }
1572
1591
  return `query getCases {
1573
1592
  cases (${whereClause} order_by: {id: desc}, limit: ${filters?.limit || 1000})
1574
1593
  {
@@ -1592,6 +1611,7 @@ const getCasesStringQuery = (filters) => {
1592
1611
  courtesy
1593
1612
  total
1594
1613
  responsible_id
1614
+ ${joins?.join("\n") || ""}
1595
1615
  client {
1596
1616
  name
1597
1617
  tin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/graphql",
3
- "version": "2.0.194",
3
+ "version": "2.0.203",
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": "c505ac82d2e9d7ec51bda567c5be91bbb0f37568"
24
+ "gitHead": "71ffd90ef4de8f031f2b507b38151902caaeb006"
25
25
  }