@webitel/api-services 0.0.76 → 0.0.78
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/package.json
CHANGED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getAuditFormService,
|
|
3
|
+
searchAuditFormQueryParams,
|
|
4
|
+
} from '@webitel/api-services/gen';
|
|
5
|
+
import { getShallowFieldsToSendFromZodSchema } from '@webitel/api-services/gen/utils';
|
|
6
|
+
|
|
7
|
+
import { getDefaultGetListResponse, getDefaultGetParams } from '../../defaults';
|
|
8
|
+
import {
|
|
9
|
+
applyTransform,
|
|
10
|
+
camelToSnake,
|
|
11
|
+
merge,
|
|
12
|
+
notify,
|
|
13
|
+
sanitize,
|
|
14
|
+
snakeToCamel,
|
|
15
|
+
} from '../../transformers';
|
|
16
|
+
|
|
17
|
+
const getAuditFormsList = async (params) => {
|
|
18
|
+
const fieldsToSend = getShallowFieldsToSendFromZodSchema(
|
|
19
|
+
searchAuditFormQueryParams,
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const transformedParams = applyTransform(params, [
|
|
23
|
+
merge(getDefaultGetParams()),
|
|
24
|
+
(params) => ({ ...params, q: params.search }),
|
|
25
|
+
sanitize(fieldsToSend),
|
|
26
|
+
camelToSnake(),
|
|
27
|
+
]);
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
const response =
|
|
31
|
+
await getAuditFormService().searchAuditForm(transformedParams);
|
|
32
|
+
const { items, next } = applyTransform(response.data, [
|
|
33
|
+
snakeToCamel(),
|
|
34
|
+
merge(getDefaultGetListResponse()),
|
|
35
|
+
]);
|
|
36
|
+
return {
|
|
37
|
+
items,
|
|
38
|
+
next,
|
|
39
|
+
};
|
|
40
|
+
} catch (err) {
|
|
41
|
+
throw applyTransform(err, [notify]);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const getAuditForm = async ({ itemId: id }) => {
|
|
46
|
+
try {
|
|
47
|
+
const response = await getAuditFormService().readAuditForm(id);
|
|
48
|
+
return applyTransform(response.data, [snakeToCamel()]);
|
|
49
|
+
} catch (err) {
|
|
50
|
+
throw applyTransform(err, [notify]);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const getLookup = (params) =>
|
|
55
|
+
getAuditFormsList({
|
|
56
|
+
...params,
|
|
57
|
+
fields: params.fields || ['id', 'name'],
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export const AuditFormsAPI = {
|
|
61
|
+
getList: getAuditFormsList,
|
|
62
|
+
get: getAuditForm,
|
|
63
|
+
getLookup,
|
|
64
|
+
};
|
package/src/api/clients/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './_shared/generatePermissionsApi';
|
|
|
2
2
|
export * from './agents/agentAbsence';
|
|
3
3
|
export * from './agents/agentChats';
|
|
4
4
|
export * from './agents/agents';
|
|
5
|
+
export * from './auditForms/auditForms';
|
|
5
6
|
export * from './buckets/buckets';
|
|
6
7
|
export * from './calendars/calendars';
|
|
7
8
|
export * from './callHistory/callHistory';
|
|
@@ -10,7 +10,7 @@ const patchMessagesService = async (changes) => {
|
|
|
10
10
|
const body = applyTransform(changes, [camelToSnake()]);
|
|
11
11
|
|
|
12
12
|
try {
|
|
13
|
-
const response = await getMessages().
|
|
13
|
+
const response = await getMessages().messagesServiceBroadcastMessage(body);
|
|
14
14
|
return applyTransform(response.data, [snakeToCamel()]);
|
|
15
15
|
} catch (err) {
|
|
16
16
|
throw applyTransform(err, [notify]);
|
|
@@ -2,6 +2,7 @@ export * from './_shared/generatePermissionsApi';
|
|
|
2
2
|
export * from './agents/agentAbsence';
|
|
3
3
|
export * from './agents/agentChats';
|
|
4
4
|
export * from './agents/agents';
|
|
5
|
+
export * from './auditForms/auditForms';
|
|
5
6
|
export * from './buckets/buckets';
|
|
6
7
|
export * from './calendars/calendars';
|
|
7
8
|
export * from './callHistory/callHistory';
|