@hapl/api-queries 0.2.69 → 0.2.70
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/dist/api-queries.cjs.development.js +1824 -1575
- package/dist/api-queries.cjs.development.js.map +1 -1
- package/dist/api-queries.cjs.production.min.js +1 -1
- package/dist/api-queries.cjs.production.min.js.map +1 -1
- package/dist/api-queries.esm.js +1824 -1575
- package/dist/api-queries.esm.js.map +1 -1
- package/dist/clients/v1/api/checklist/findChecklistByServiceRequestId.d.ts +29 -0
- package/dist/clients/v1/api/checklist/findChecklistQuestionDictionaries.d.ts +24 -0
- package/dist/clients/v1/api/checklist/updateChecklist.d.ts +36 -0
- package/dist/clients/v1/api/checklist/updateChecklistTask.d.ts +36 -0
- package/dist/clients/v1/api/index.d.ts +4 -0
- package/dist/clients/v1/index.d.ts +4 -0
- package/dist/clients/v1/types/Checklist.d.ts +49 -0
- package/dist/clients/v1/types/ServiceRequest.d.ts +2 -0
- package/dist/clients/v1/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/clients/v1/api/checklist/findChecklistByServiceRequestId.ts +39 -0
- package/src/clients/v1/api/checklist/findChecklistQuestionDictionaries.ts +47 -0
- package/src/clients/v1/api/checklist/updateChecklist.ts +47 -0
- package/src/clients/v1/api/checklist/updateChecklistTask.ts +53 -0
- package/src/clients/v1/api/index.ts +5 -0
- package/src/clients/v1/index.ts +29 -0
- package/src/clients/v1/types/Checklist.ts +56 -0
- package/src/clients/v1/types/ServiceRequest.ts +2 -0
- package/src/clients/v1/types/index.ts +1 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AxiosResponse, AxiosError } from 'axios';
|
|
2
|
+
import { Checklist } from '../../types';
|
|
3
|
+
declare type SuccessData = {
|
|
4
|
+
success: true;
|
|
5
|
+
data: Checklist;
|
|
6
|
+
};
|
|
7
|
+
declare type ErrorData = {
|
|
8
|
+
success: false;
|
|
9
|
+
data: {
|
|
10
|
+
error: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
declare type ResultData = SuccessData['data'];
|
|
14
|
+
declare type ResultError = ErrorData['data']['error'];
|
|
15
|
+
export declare type FindChecklistByServiceRequestIdUrlParams = {
|
|
16
|
+
serviceRequestId: number;
|
|
17
|
+
};
|
|
18
|
+
export declare type FindChecklistByServiceRequestIdHeaders = {
|
|
19
|
+
'x-auth-hc'?: string;
|
|
20
|
+
};
|
|
21
|
+
export declare type FindChecklistByServiceRequestIdData = AxiosResponse<ResultData>;
|
|
22
|
+
export declare type FindChecklistByServiceRequestIdError = AxiosError<ResultError>;
|
|
23
|
+
export declare type FindChecklistByServiceRequestIdConfig = {
|
|
24
|
+
baseURL?: string;
|
|
25
|
+
urlParams: FindChecklistByServiceRequestIdUrlParams;
|
|
26
|
+
headers?: FindChecklistByServiceRequestIdHeaders;
|
|
27
|
+
};
|
|
28
|
+
export declare function findChecklistByServiceRequestIdRequest({ baseURL, urlParams, headers, }: FindChecklistByServiceRequestIdConfig): Promise<FindChecklistByServiceRequestIdData>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AxiosResponse, AxiosError } from 'axios';
|
|
2
|
+
import { ChecklistQuestionDictionary } from '../../types';
|
|
3
|
+
declare type ErrorData = {
|
|
4
|
+
success: false;
|
|
5
|
+
data: {
|
|
6
|
+
error: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
declare type ResultData = {
|
|
10
|
+
ids: number[];
|
|
11
|
+
byId: Record<string, ChecklistQuestionDictionary>;
|
|
12
|
+
};
|
|
13
|
+
declare type ResultError = ErrorData['data']['error'];
|
|
14
|
+
export declare type FindChecklistQuestionsHeaders = {
|
|
15
|
+
'x-auth-hc': string;
|
|
16
|
+
};
|
|
17
|
+
export declare type FindChecklistQuestionsData = AxiosResponse<ResultData>;
|
|
18
|
+
export declare type FindChecklistQuestionsError = AxiosError<ResultError>;
|
|
19
|
+
export declare type FindChecklistQuestionsConfig = {
|
|
20
|
+
baseURL?: string;
|
|
21
|
+
headers: FindChecklistQuestionsHeaders;
|
|
22
|
+
};
|
|
23
|
+
export declare function findChecklistQuestionDictionariesRequest({ baseURL, headers, }: FindChecklistQuestionsConfig): Promise<FindChecklistQuestionsData>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AxiosResponse, AxiosError } from 'axios';
|
|
2
|
+
import { Checklist, ChecklistQuestionDictionary, ChecklistAnswerDictionary } from '../../types';
|
|
3
|
+
declare type SuccessData = {
|
|
4
|
+
success: true;
|
|
5
|
+
data: Checklist;
|
|
6
|
+
};
|
|
7
|
+
declare type ErrorData = {
|
|
8
|
+
success: false;
|
|
9
|
+
data: {
|
|
10
|
+
error: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
declare type ResultData = SuccessData['data'];
|
|
14
|
+
declare type ResultError = ErrorData['data']['error'];
|
|
15
|
+
export declare type UpdateChecklistUrlParams = {
|
|
16
|
+
serviceRequestId: number;
|
|
17
|
+
};
|
|
18
|
+
export declare type UpdateChecklistHeaders = {
|
|
19
|
+
'x-auth-hc': string;
|
|
20
|
+
};
|
|
21
|
+
export declare type UpdateChecklistBody = {
|
|
22
|
+
checkListAnswers?: Array<{
|
|
23
|
+
question: Required<Pick<ChecklistQuestionDictionary, 'id'>>;
|
|
24
|
+
answer: Required<Pick<ChecklistAnswerDictionary, 'id'>>;
|
|
25
|
+
}>;
|
|
26
|
+
};
|
|
27
|
+
export declare type UpdateChecklistData = AxiosResponse<ResultData>;
|
|
28
|
+
export declare type UpdateChecklistError = AxiosError<ResultError>;
|
|
29
|
+
export declare type UpdateChecklistConfig = {
|
|
30
|
+
baseURL?: string;
|
|
31
|
+
urlParams: UpdateChecklistUrlParams;
|
|
32
|
+
headers: UpdateChecklistHeaders;
|
|
33
|
+
body: UpdateChecklistBody;
|
|
34
|
+
};
|
|
35
|
+
export declare function updateChecklistRequest({ baseURL, urlParams, body, headers, }: UpdateChecklistConfig): Promise<UpdateChecklistData>;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AxiosResponse, AxiosError } from 'axios';
|
|
2
|
+
import { ChecklistTask, File } from '../../types';
|
|
3
|
+
declare type SuccessData = {
|
|
4
|
+
success: true;
|
|
5
|
+
data: ChecklistTask;
|
|
6
|
+
};
|
|
7
|
+
declare type ErrorData = {
|
|
8
|
+
success: false;
|
|
9
|
+
data: {
|
|
10
|
+
error: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
declare type ResultData = SuccessData['data'];
|
|
14
|
+
declare type ResultError = ErrorData['data']['error'];
|
|
15
|
+
export declare type UpdateChecklistTaskUrlParams = {
|
|
16
|
+
srId: number;
|
|
17
|
+
answerId: number;
|
|
18
|
+
taskId: number;
|
|
19
|
+
};
|
|
20
|
+
export declare type UpdateChecklistTaskHeaders = {
|
|
21
|
+
'x-auth-hc': string;
|
|
22
|
+
};
|
|
23
|
+
export declare type UpdateChecklistTaskBody = {
|
|
24
|
+
comment?: string;
|
|
25
|
+
files?: Array<Pick<File, 'id' | 'type' | 'name' | 'url'>>;
|
|
26
|
+
};
|
|
27
|
+
export declare type UpdateChecklistTaskData = AxiosResponse<ResultData>;
|
|
28
|
+
export declare type UpdateChecklistTaskError = AxiosError<ResultError>;
|
|
29
|
+
export declare type UpdateChecklistTaskConfig = {
|
|
30
|
+
baseURL?: string;
|
|
31
|
+
urlParams: UpdateChecklistTaskUrlParams;
|
|
32
|
+
headers: UpdateChecklistTaskHeaders;
|
|
33
|
+
body: UpdateChecklistTaskBody;
|
|
34
|
+
};
|
|
35
|
+
export declare function updateChecklistTaskRequest({ baseURL, urlParams, body, headers, }: UpdateChecklistTaskConfig): Promise<UpdateChecklistTaskData>;
|
|
36
|
+
export {};
|
|
@@ -51,6 +51,10 @@ export * from './callTask/joinCallTaskCall';
|
|
|
51
51
|
export * from './callTask/returnCallTaskCall';
|
|
52
52
|
export * from './callTask/shiftCallTask';
|
|
53
53
|
export * from './callTask/updateCallTask';
|
|
54
|
+
export * from './checklist/findChecklistByServiceRequestId';
|
|
55
|
+
export * from './checklist/findChecklistQuestionDictionaries';
|
|
56
|
+
export * from './checklist/updateChecklist';
|
|
57
|
+
export * from './checklist/updateChecklistTask';
|
|
54
58
|
export * from './comment/findComments';
|
|
55
59
|
export * from './company/createCompany';
|
|
56
60
|
export * from './company/findCompanies';
|
|
@@ -55,6 +55,10 @@ export declare class Api {
|
|
|
55
55
|
returnCallTaskCall: (urlParams: api.ReturnCallTaskCallUrlParams, headers?: api.ReturnCallTaskCallHeaders | undefined) => Promise<api.ReturnCallTaskCallData>;
|
|
56
56
|
shiftCallTask: (urlParams: api.ShiftCallTaskUrlParams, body: api.ShiftCallTaskBody, headers?: api.ShiftCallTaskHeaders | undefined) => Promise<api.ShiftCallTaskData>;
|
|
57
57
|
updateCallTask: (urlParams: api.UpdateCallTaskUrlParams, body: api.UpdateCallTaskBody, headers: api.FindCallTasksHeaders) => Promise<api.UpdateCallTaskData>;
|
|
58
|
+
findChecklistByServiceRequestId: (urlParams: api.FindChecklistByServiceRequestIdUrlParams, headers: api.FindChecklistByServiceRequestIdHeaders) => Promise<api.FindChecklistByServiceRequestIdData>;
|
|
59
|
+
findChecklistQuestionDictionaries: (headers: api.FindChecklistQuestionsHeaders) => Promise<api.FindChecklistQuestionsData>;
|
|
60
|
+
updateChecklist: (urlParams: api.UpdateChecklistUrlParams, body: api.UpdateChecklistBody, headers: api.UpdateChecklistHeaders) => Promise<api.UpdateChecklistData>;
|
|
61
|
+
updateChecklistTask: (urlParams: api.UpdateChecklistTaskUrlParams, body: api.UpdateChecklistTaskBody, headers: api.UpdateChecklistTaskHeaders) => Promise<api.UpdateChecklistTaskData>;
|
|
58
62
|
findComments: (params: api.FindCommentsParams, headers: api.FindCommentsHeaders) => Promise<api.FindCommentsData>;
|
|
59
63
|
createCompany: (body: api.CreateCompanyBody, headers: api.CreateCompanyHeaders) => Promise<api.CreateCompanyData>;
|
|
60
64
|
findCompanies: (params: api.FindCompaniesParams, headers: api.FindCompaniesHeaders) => Promise<api.FindCompaniesData>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { File } from './File';
|
|
2
|
+
import { ServiceRequest } from './ServiceRequest';
|
|
3
|
+
export declare enum ChecklistTaskDictionaryDirectedFor {
|
|
4
|
+
Expert = "expert",
|
|
5
|
+
Lawyer = "lawyer",
|
|
6
|
+
Supervisor = "supervisor"
|
|
7
|
+
}
|
|
8
|
+
export declare type ChecklistTaskDictionary = {
|
|
9
|
+
answerId: number;
|
|
10
|
+
directedFor: ChecklistTaskDictionaryDirectedFor;
|
|
11
|
+
id: number;
|
|
12
|
+
isFileRequired: boolean;
|
|
13
|
+
text: string;
|
|
14
|
+
};
|
|
15
|
+
export declare type ChecklistAnswerDictionary = {
|
|
16
|
+
id: number;
|
|
17
|
+
isPositive: boolean;
|
|
18
|
+
questionId: number;
|
|
19
|
+
tasks: Array<ChecklistTaskDictionary>;
|
|
20
|
+
text: string;
|
|
21
|
+
};
|
|
22
|
+
export declare type ChecklistQuestionDictionary = {
|
|
23
|
+
id: number;
|
|
24
|
+
possibleAnswers: Array<ChecklistAnswerDictionary>;
|
|
25
|
+
text: string;
|
|
26
|
+
};
|
|
27
|
+
export declare type ChecklistTask = {
|
|
28
|
+
createdAt: string;
|
|
29
|
+
files: File[];
|
|
30
|
+
id: number;
|
|
31
|
+
taskDictionary: ChecklistTaskDictionary;
|
|
32
|
+
comment?: string;
|
|
33
|
+
};
|
|
34
|
+
export declare type ChecklistAnswer = {
|
|
35
|
+
createdAt: string;
|
|
36
|
+
id: number;
|
|
37
|
+
question: Partial<ChecklistQuestionDictionary> & Required<Pick<ChecklistQuestionDictionary, 'id'>>;
|
|
38
|
+
tasks: ChecklistTask[];
|
|
39
|
+
answer?: ChecklistAnswerDictionary;
|
|
40
|
+
updatedAt?: string;
|
|
41
|
+
};
|
|
42
|
+
export declare type Checklist = {
|
|
43
|
+
checkListAnswers: Array<ChecklistAnswer>;
|
|
44
|
+
createdAt: string;
|
|
45
|
+
id: number;
|
|
46
|
+
isComplete: boolean;
|
|
47
|
+
problemCount: number;
|
|
48
|
+
serviceRequest: Partial<ServiceRequest> & Required<Pick<ServiceRequest, 'id'>>;
|
|
49
|
+
};
|
|
@@ -7,6 +7,7 @@ import { Task } from './Task';
|
|
|
7
7
|
import { User } from './User';
|
|
8
8
|
import { CallTaskDirection } from './CallTask';
|
|
9
9
|
import { Company } from './Company';
|
|
10
|
+
import { Checklist } from './Checklist';
|
|
10
11
|
export declare enum ServiceRequestCategory {
|
|
11
12
|
Depublished = "depublished",
|
|
12
13
|
Discounted = "discounted",
|
|
@@ -126,6 +127,7 @@ export declare type ServiceRequest = {
|
|
|
126
127
|
crossSaleCount?: number;
|
|
127
128
|
verifiedAt?: string;
|
|
128
129
|
canBePublishedAt?: string;
|
|
130
|
+
checkList?: Pick<Checklist, 'id' | 'isComplete' | 'problemCount'>;
|
|
129
131
|
closeRequestedAt?: string;
|
|
130
132
|
closedAt?: string;
|
|
131
133
|
closingReason?: string;
|
package/package.json
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import axios, { AxiosResponse, AxiosError, AxiosResponseTransformer } from 'axios';
|
|
2
|
+
import { Checklist } from '../../types';
|
|
3
|
+
|
|
4
|
+
type SuccessData = { success: true; data: Checklist };
|
|
5
|
+
type ErrorData = { success: false; data: { error: string } };
|
|
6
|
+
|
|
7
|
+
type ResultData = SuccessData['data'];
|
|
8
|
+
type ResultError = ErrorData['data']['error'];
|
|
9
|
+
|
|
10
|
+
export type FindChecklistByServiceRequestIdUrlParams = { serviceRequestId: number };
|
|
11
|
+
export type FindChecklistByServiceRequestIdHeaders = { 'x-auth-hc'?: string };
|
|
12
|
+
export type FindChecklistByServiceRequestIdData = AxiosResponse<ResultData>;
|
|
13
|
+
export type FindChecklistByServiceRequestIdError = AxiosError<ResultError>;
|
|
14
|
+
|
|
15
|
+
export type FindChecklistByServiceRequestIdConfig = {
|
|
16
|
+
baseURL?: string;
|
|
17
|
+
urlParams: FindChecklistByServiceRequestIdUrlParams;
|
|
18
|
+
headers?: FindChecklistByServiceRequestIdHeaders;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export function findChecklistByServiceRequestIdRequest({
|
|
22
|
+
baseURL = 'https://clients.homeapp.ru',
|
|
23
|
+
urlParams,
|
|
24
|
+
headers,
|
|
25
|
+
}: FindChecklistByServiceRequestIdConfig) {
|
|
26
|
+
return axios
|
|
27
|
+
.get(`/api/service-request/${urlParams.serviceRequestId}/check-list`, {
|
|
28
|
+
baseURL,
|
|
29
|
+
headers: { Accept: 'application/json', ...headers },
|
|
30
|
+
transformResponse: [
|
|
31
|
+
...(axios.defaults.transformResponse as AxiosResponseTransformer[]),
|
|
32
|
+
(data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
|
|
33
|
+
],
|
|
34
|
+
})
|
|
35
|
+
.then((res: FindChecklistByServiceRequestIdData) => res)
|
|
36
|
+
.catch((err: FindChecklistByServiceRequestIdError) => {
|
|
37
|
+
throw err;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import axios, { AxiosResponse, AxiosError, AxiosResponseTransformer } from 'axios';
|
|
2
|
+
import { ChecklistQuestionDictionary } from '../../types';
|
|
3
|
+
|
|
4
|
+
type SuccessData = { success: true; data: ChecklistQuestionDictionary[] };
|
|
5
|
+
type ErrorData = { success: false; data: { error: string } };
|
|
6
|
+
|
|
7
|
+
type ResultData = { ids: number[]; byId: Record<string, ChecklistQuestionDictionary> };
|
|
8
|
+
type ResultError = ErrorData['data']['error'];
|
|
9
|
+
|
|
10
|
+
export type FindChecklistQuestionsHeaders = { 'x-auth-hc': string };
|
|
11
|
+
export type FindChecklistQuestionsData = AxiosResponse<ResultData>;
|
|
12
|
+
export type FindChecklistQuestionsError = AxiosError<ResultError>;
|
|
13
|
+
export type FindChecklistQuestionsConfig = {
|
|
14
|
+
baseURL?: string;
|
|
15
|
+
headers: FindChecklistQuestionsHeaders;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function findChecklistQuestionDictionariesRequest({
|
|
19
|
+
baseURL = 'https://clients.homeapp.ru',
|
|
20
|
+
headers,
|
|
21
|
+
}: FindChecklistQuestionsConfig) {
|
|
22
|
+
return axios
|
|
23
|
+
.get('/api/check-list/dictionary', {
|
|
24
|
+
baseURL,
|
|
25
|
+
headers: { Accept: 'application/json', ...headers },
|
|
26
|
+
transformResponse: [
|
|
27
|
+
...(axios.defaults.transformResponse as AxiosResponseTransformer[]),
|
|
28
|
+
(data: SuccessData | ErrorData): ResultData | ResultError => {
|
|
29
|
+
if (!data.success) return data.data.error;
|
|
30
|
+
|
|
31
|
+
const ids: ResultData['ids'] = [];
|
|
32
|
+
const byId: ResultData['byId'] = {};
|
|
33
|
+
|
|
34
|
+
data.data.forEach(entity => {
|
|
35
|
+
byId[entity.id] = entity;
|
|
36
|
+
ids.push(entity.id);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
return { ids, byId };
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
})
|
|
43
|
+
.then((res: FindChecklistQuestionsData) => res)
|
|
44
|
+
.catch((err: FindChecklistQuestionsError) => {
|
|
45
|
+
throw err;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import axios, { AxiosResponse, AxiosError, AxiosResponseTransformer } from 'axios';
|
|
2
|
+
import { Checklist, ChecklistQuestionDictionary, ChecklistAnswerDictionary } from '../../types';
|
|
3
|
+
|
|
4
|
+
type SuccessData = { success: true; data: Checklist };
|
|
5
|
+
type ErrorData = { success: false; data: { error: string } };
|
|
6
|
+
|
|
7
|
+
type ResultData = SuccessData['data'];
|
|
8
|
+
type ResultError = ErrorData['data']['error'];
|
|
9
|
+
|
|
10
|
+
export type UpdateChecklistUrlParams = { serviceRequestId: number };
|
|
11
|
+
export type UpdateChecklistHeaders = { 'x-auth-hc': string };
|
|
12
|
+
export type UpdateChecklistBody = {
|
|
13
|
+
checkListAnswers?: Array<{
|
|
14
|
+
question: Required<Pick<ChecklistQuestionDictionary, 'id'>>;
|
|
15
|
+
answer: Required<Pick<ChecklistAnswerDictionary, 'id'>>;
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type UpdateChecklistData = AxiosResponse<ResultData>;
|
|
20
|
+
export type UpdateChecklistError = AxiosError<ResultError>;
|
|
21
|
+
export type UpdateChecklistConfig = {
|
|
22
|
+
baseURL?: string;
|
|
23
|
+
urlParams: UpdateChecklistUrlParams;
|
|
24
|
+
headers: UpdateChecklistHeaders;
|
|
25
|
+
body: UpdateChecklistBody;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export function updateChecklistRequest({
|
|
29
|
+
baseURL = 'https://clients.homeapp.ru',
|
|
30
|
+
urlParams,
|
|
31
|
+
body,
|
|
32
|
+
headers,
|
|
33
|
+
}: UpdateChecklistConfig) {
|
|
34
|
+
return axios
|
|
35
|
+
.patch(`/api/service-request/${urlParams.serviceRequestId}/check-list`, body, {
|
|
36
|
+
baseURL,
|
|
37
|
+
headers: { Accept: 'application/json', 'Content-Type': 'application/json', ...headers },
|
|
38
|
+
transformResponse: [
|
|
39
|
+
...(axios.defaults.transformResponse as AxiosResponseTransformer[]),
|
|
40
|
+
(data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
|
|
41
|
+
],
|
|
42
|
+
})
|
|
43
|
+
.then((res: UpdateChecklistData) => res)
|
|
44
|
+
.catch((err: UpdateChecklistError) => {
|
|
45
|
+
throw err;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import axios, { AxiosResponse, AxiosError, AxiosResponseTransformer } from 'axios';
|
|
2
|
+
import { ChecklistTask, File } from '../../types';
|
|
3
|
+
|
|
4
|
+
type SuccessData = { success: true; data: ChecklistTask };
|
|
5
|
+
type ErrorData = { success: false; data: { error: string } };
|
|
6
|
+
|
|
7
|
+
type ResultData = SuccessData['data'];
|
|
8
|
+
type ResultError = ErrorData['data']['error'];
|
|
9
|
+
|
|
10
|
+
export type UpdateChecklistTaskUrlParams = {
|
|
11
|
+
srId: number;
|
|
12
|
+
answerId: number;
|
|
13
|
+
taskId: number;
|
|
14
|
+
};
|
|
15
|
+
export type UpdateChecklistTaskHeaders = { 'x-auth-hc': string };
|
|
16
|
+
export type UpdateChecklistTaskBody = {
|
|
17
|
+
comment?: string;
|
|
18
|
+
files?: Array<Pick<File, 'id' | 'type' | 'name' | 'url'>>;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type UpdateChecklistTaskData = AxiosResponse<ResultData>;
|
|
22
|
+
export type UpdateChecklistTaskError = AxiosError<ResultError>;
|
|
23
|
+
export type UpdateChecklistTaskConfig = {
|
|
24
|
+
baseURL?: string;
|
|
25
|
+
urlParams: UpdateChecklistTaskUrlParams;
|
|
26
|
+
headers: UpdateChecklistTaskHeaders;
|
|
27
|
+
body: UpdateChecklistTaskBody;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export function updateChecklistTaskRequest({
|
|
31
|
+
baseURL = 'https://clients.homeapp.ru',
|
|
32
|
+
urlParams,
|
|
33
|
+
body,
|
|
34
|
+
headers,
|
|
35
|
+
}: UpdateChecklistTaskConfig) {
|
|
36
|
+
return axios
|
|
37
|
+
.patch(
|
|
38
|
+
`/api/service-request/${urlParams.srId}/check-list/answer/${urlParams.answerId}/task/${urlParams.taskId}`,
|
|
39
|
+
body,
|
|
40
|
+
{
|
|
41
|
+
baseURL,
|
|
42
|
+
headers: { Accept: 'application/json', 'Content-Type': 'application/json', ...headers },
|
|
43
|
+
transformResponse: [
|
|
44
|
+
...(axios.defaults.transformResponse as AxiosResponseTransformer[]),
|
|
45
|
+
(data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
|
|
46
|
+
],
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
.then((res: UpdateChecklistTaskData) => res)
|
|
50
|
+
.catch((err: UpdateChecklistTaskError) => {
|
|
51
|
+
throw err;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
@@ -60,6 +60,11 @@ export * from './callTask/returnCallTaskCall';
|
|
|
60
60
|
export * from './callTask/shiftCallTask';
|
|
61
61
|
export * from './callTask/updateCallTask';
|
|
62
62
|
|
|
63
|
+
export * from './checklist/findChecklistByServiceRequestId';
|
|
64
|
+
export * from './checklist/findChecklistQuestionDictionaries';
|
|
65
|
+
export * from './checklist/updateChecklist';
|
|
66
|
+
export * from './checklist/updateChecklistTask';
|
|
67
|
+
|
|
63
68
|
export * from './comment/findComments';
|
|
64
69
|
|
|
65
70
|
export * from './company/createCompany';
|
package/src/clients/v1/index.ts
CHANGED
|
@@ -308,6 +308,35 @@ export class Api {
|
|
|
308
308
|
return api.updateCallTaskRequest({ urlParams, body, headers, baseURL: await this.baseURL });
|
|
309
309
|
};
|
|
310
310
|
|
|
311
|
+
// checklist
|
|
312
|
+
|
|
313
|
+
findChecklistByServiceRequestId = async (
|
|
314
|
+
urlParams: api.FindChecklistByServiceRequestIdUrlParams,
|
|
315
|
+
headers: api.FindChecklistByServiceRequestIdHeaders
|
|
316
|
+
) => {
|
|
317
|
+
return api.findChecklistByServiceRequestIdRequest({ urlParams, headers, baseURL: await this.baseURL });
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
findChecklistQuestionDictionaries = async (headers: api.FindChecklistQuestionsHeaders) => {
|
|
321
|
+
return api.findChecklistQuestionDictionariesRequest({ headers, baseURL: await this.baseURL });
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
updateChecklist = async (
|
|
325
|
+
urlParams: api.UpdateChecklistUrlParams,
|
|
326
|
+
body: api.UpdateChecklistBody,
|
|
327
|
+
headers: api.UpdateChecklistHeaders
|
|
328
|
+
) => {
|
|
329
|
+
return api.updateChecklistRequest({ urlParams, body, headers, baseURL: await this.baseURL });
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
updateChecklistTask = async (
|
|
333
|
+
urlParams: api.UpdateChecklistTaskUrlParams,
|
|
334
|
+
body: api.UpdateChecklistTaskBody,
|
|
335
|
+
headers: api.UpdateChecklistTaskHeaders
|
|
336
|
+
) => {
|
|
337
|
+
return api.updateChecklistTaskRequest({ urlParams, body, headers, baseURL: await this.baseURL });
|
|
338
|
+
};
|
|
339
|
+
|
|
311
340
|
// comment
|
|
312
341
|
|
|
313
342
|
findComments = async (params: api.FindCommentsParams, headers: api.FindCommentsHeaders) => {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { File } from './File';
|
|
2
|
+
import { ServiceRequest } from './ServiceRequest';
|
|
3
|
+
|
|
4
|
+
export enum ChecklistTaskDictionaryDirectedFor {
|
|
5
|
+
Expert = 'expert',
|
|
6
|
+
Lawyer = 'lawyer',
|
|
7
|
+
Supervisor = 'supervisor',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type ChecklistTaskDictionary = {
|
|
11
|
+
answerId: number;
|
|
12
|
+
directedFor: ChecklistTaskDictionaryDirectedFor;
|
|
13
|
+
id: number;
|
|
14
|
+
isFileRequired: boolean;
|
|
15
|
+
text: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type ChecklistAnswerDictionary = {
|
|
19
|
+
id: number;
|
|
20
|
+
isPositive: boolean;
|
|
21
|
+
questionId: number;
|
|
22
|
+
tasks: Array<ChecklistTaskDictionary>;
|
|
23
|
+
text: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type ChecklistQuestionDictionary = {
|
|
27
|
+
id: number;
|
|
28
|
+
possibleAnswers: Array<ChecklistAnswerDictionary>;
|
|
29
|
+
text: string;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type ChecklistTask = {
|
|
33
|
+
createdAt: string;
|
|
34
|
+
files: File[];
|
|
35
|
+
id: number;
|
|
36
|
+
taskDictionary: ChecklistTaskDictionary;
|
|
37
|
+
comment?: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type ChecklistAnswer = {
|
|
41
|
+
createdAt: string;
|
|
42
|
+
id: number;
|
|
43
|
+
question: Partial<ChecklistQuestionDictionary> & Required<Pick<ChecklistQuestionDictionary, 'id'>>;
|
|
44
|
+
tasks: ChecklistTask[];
|
|
45
|
+
answer?: ChecklistAnswerDictionary;
|
|
46
|
+
updatedAt?: string;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export type Checklist = {
|
|
50
|
+
checkListAnswers: Array<ChecklistAnswer>;
|
|
51
|
+
createdAt: string;
|
|
52
|
+
id: number;
|
|
53
|
+
isComplete: boolean;
|
|
54
|
+
problemCount: number;
|
|
55
|
+
serviceRequest: Partial<ServiceRequest> & Required<Pick<ServiceRequest, 'id'>>;
|
|
56
|
+
};
|
|
@@ -7,6 +7,7 @@ import { Task } from './Task';
|
|
|
7
7
|
import { User } from './User';
|
|
8
8
|
import { CallTaskDirection } from './CallTask';
|
|
9
9
|
import { Company } from './Company';
|
|
10
|
+
import { Checklist } from './Checklist';
|
|
10
11
|
|
|
11
12
|
export enum ServiceRequestCategory {
|
|
12
13
|
Depublished = 'depublished',
|
|
@@ -127,6 +128,7 @@ export type ServiceRequest = {
|
|
|
127
128
|
crossSaleCount?: number;
|
|
128
129
|
verifiedAt?: string;
|
|
129
130
|
canBePublishedAt?: string;
|
|
131
|
+
checkList?: Pick<Checklist, 'id' | 'isComplete' | 'problemCount'>;
|
|
130
132
|
closeRequestedAt?: string;
|
|
131
133
|
closedAt?: string;
|
|
132
134
|
closingReason?: string;
|