@zauru-sdk/utils 2.0.169 → 2.0.170

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.
@@ -15,3 +15,30 @@ export const getMyCases = async (session, filters) => {
15
15
  return response?.data ?? [];
16
16
  });
17
17
  };
18
+ /**
19
+ * makeCaseSuppliesWithPrice
20
+ * @param case_supplies
21
+ * @returns
22
+ */
23
+ export const makeCaseSuppliesWithPrice = (case_supplies, deleted_case_supplies = []) => {
24
+ return [
25
+ ...case_supplies.map((x) => {
26
+ const item_id = Number(x.item_id);
27
+ const id = isNaN(x.id) ? undefined : x.id;
28
+ return {
29
+ id,
30
+ item_id,
31
+ quantity: Number(x.quantity),
32
+ unit_price: Number(x.unit_price),
33
+ reference: x.reference,
34
+ _destroy: false,
35
+ };
36
+ }),
37
+ ...deleted_case_supplies.map((x) => {
38
+ return {
39
+ id: x.id,
40
+ _destroy: true,
41
+ };
42
+ }),
43
+ ];
44
+ };
@@ -1,5 +1,5 @@
1
1
  import type { Session } from "@remix-run/node";
2
- import { AxiosUtilsResponse, CaseGraphQL } from "@zauru-sdk/types";
2
+ import { AxiosUtilsResponse, CaseGraphQL, CaseSupplyGraphQL } from "@zauru-sdk/types";
3
3
  /**
4
4
  *
5
5
  * @param headers
@@ -11,3 +11,9 @@ export declare const getMyCases: (session: Session, filters?: {
11
11
  closed?: boolean;
12
12
  client_id?: number;
13
13
  }) => Promise<AxiosUtilsResponse<CaseGraphQL[]>>;
14
+ /**
15
+ * makeCaseSuppliesWithPrice
16
+ * @param case_supplies
17
+ * @returns
18
+ */
19
+ export declare const makeCaseSuppliesWithPrice: (case_supplies: any[], deleted_case_supplies?: any[]) => CaseSupplyGraphQL[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/utils",
3
- "version": "2.0.169",
3
+ "version": "2.0.170",
4
4
  "description": "Utilidades, parseo de request y demás para desarrollo de webapps de Zauru",
5
5
  "main": "./dist/esm/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -24,11 +24,11 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@remix-run/node": "^2.8.1",
27
- "@zauru-sdk/common": "^2.0.164",
27
+ "@zauru-sdk/common": "^2.0.170",
28
28
  "@zauru-sdk/config": "^2.0.100",
29
29
  "@zauru-sdk/graphql": "^2.0.169",
30
- "@zauru-sdk/services": "^2.0.169",
31
- "@zauru-sdk/types": "^2.0.164"
30
+ "@zauru-sdk/services": "^2.0.170",
31
+ "@zauru-sdk/types": "^2.0.170"
32
32
  },
33
- "gitHead": "cb9bc2cccbff6605a48b0771ab6cc422a7a9df4e"
33
+ "gitHead": "864ff8a1835aacaa8f7487bb2cfa6f38e6ba3367"
34
34
  }