@zauru-sdk/utils 2.0.168 → 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.
|
@@ -6,12 +6,39 @@ import { getCasesByResponsibleId } from "@zauru-sdk/services";
|
|
|
6
6
|
* @param session
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
|
-
export const getMyCases = async (session,
|
|
9
|
+
export const getMyCases = async (session, filters) => {
|
|
10
10
|
return handlePossibleAxiosErrors(async () => {
|
|
11
|
-
const response = await getCasesByResponsibleId(session,
|
|
11
|
+
const response = await getCasesByResponsibleId(session, filters);
|
|
12
12
|
if (response.error) {
|
|
13
13
|
throw new Error(`Ocurrió un error al consultar los casos asignados a este usuario: ${response.userMsg}`);
|
|
14
14
|
}
|
|
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,9 +1,19 @@
|
|
|
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
|
|
6
6
|
* @param session
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
|
-
export declare const getMyCases: (session: Session,
|
|
9
|
+
export declare const getMyCases: (session: Session, filters?: {
|
|
10
|
+
responsible_id?: number;
|
|
11
|
+
closed?: boolean;
|
|
12
|
+
client_id?: number;
|
|
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.
|
|
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.
|
|
27
|
+
"@zauru-sdk/common": "^2.0.170",
|
|
28
28
|
"@zauru-sdk/config": "^2.0.100",
|
|
29
|
-
"@zauru-sdk/graphql": "^2.0.
|
|
30
|
-
"@zauru-sdk/services": "^2.0.
|
|
31
|
-
"@zauru-sdk/types": "^2.0.
|
|
29
|
+
"@zauru-sdk/graphql": "^2.0.169",
|
|
30
|
+
"@zauru-sdk/services": "^2.0.170",
|
|
31
|
+
"@zauru-sdk/types": "^2.0.170"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "864ff8a1835aacaa8f7487bb2cfa6f38e6ba3367"
|
|
34
34
|
}
|