@omniumretail/shared-resources 0.1.81 → 0.1.83
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/bundle.js +1 -1
- package/dist/types/hooks/Asta/Actions/get/getActionByIdQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Asta/Actions/get/getActionPriorityQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Asta/Actions/get/getActionQuery.hook.d.ts +11 -0
- package/dist/types/hooks/Asta/Actions/mutate/useActionMutateQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Asta/Actions/others/archiveActionQuery.hook.d.ts +6 -0
- package/dist/types/hooks/Asta/Actions/others/deleteActionQuery.hook.d.ts +6 -0
- package/dist/types/hooks/Asta/Actions/others/extractActionQuery.hook.d.ts +6 -0
- package/dist/types/hooks/Asta/Actions/others/finishActionQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Asta/AnswerType/get/getAllAnswerTypeQuery.hook.d.ts +11 -0
- package/dist/types/hooks/Asta/AnswerType/get/getAnswerColorsQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Asta/AnswerType/get/getAnswerTypeByIdQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Asta/AnswerType/mutate/useAnswerTypeMutateQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Asta/AnswerType/others/deleteAnswerTypeQuery.hook.d.ts +6 -0
- package/dist/types/hooks/Asta/AnswerType/others/finishAnswerTypeQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Asta/Inspection/get/getInspectionQuery.hook.d.ts +2 -2
- package/dist/types/hooks/Asta/Inspection/others/archiveTemplateQuery.hook.d.ts +6 -0
- package/dist/types/hooks/Asta/Inspection/others/deleteInspectionQuery.hook.d.ts +5 -1
- package/dist/types/hooks/Asta/Inspection/others/extractTemplateQuery.hook.d.ts +6 -0
- package/dist/types/hooks/Asta/Template/get/getTemplateQuery.hook.d.ts +2 -2
- package/dist/types/hooks/index.d.ts +17 -0
- package/dist/types/interfaces/Actions.d.ts +18 -0
- package/dist/types/interfaces/AnswerType.d.ts +2 -0
- package/dist/types/interfaces/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/hooks/Asta/Actions/get/getActionByIdQuery.hook.ts +15 -0
- package/src/hooks/Asta/Actions/get/getActionPriorityQuery.hook.ts +10 -0
- package/src/hooks/Asta/Actions/get/getActionQuery.hook.ts +29 -0
- package/src/hooks/Asta/Actions/mutate/useActionMutateQuery.hook.ts +20 -0
- package/src/hooks/Asta/Actions/others/archiveActionQuery.hook.ts +19 -0
- package/src/hooks/Asta/Actions/others/deleteActionQuery.hook.ts +19 -0
- package/src/hooks/Asta/Actions/others/extractActionQuery.hook.ts +19 -0
- package/src/hooks/Asta/Actions/others/finishActionQuery.hook.ts +17 -0
- package/src/hooks/Asta/AnswerType/get/getAllAnswerTypeQuery.hook.ts +29 -0
- package/src/hooks/Asta/AnswerType/get/getAnswerColorsQuery.hook.ts +10 -0
- package/src/hooks/Asta/AnswerType/get/getAnswerTypeByIdQuery.hook.ts +15 -0
- package/src/hooks/Asta/AnswerType/mutate/useAnswerTypeMutateQuery.hook.ts +20 -0
- package/src/hooks/Asta/AnswerType/others/deleteAnswerTypeQuery.hook.ts +19 -0
- package/src/hooks/Asta/AnswerType/others/finishAnswerTypeQuery.hook.ts +17 -0
- package/src/hooks/Asta/Inspection/get/getInspectionQuery.hook.ts +2 -2
- package/src/hooks/Asta/Inspection/others/archiveTemplateQuery.hook.ts +19 -0
- package/src/hooks/Asta/Inspection/others/deleteInspectionQuery.hook.ts +8 -4
- package/src/hooks/Asta/Inspection/others/extractTemplateQuery.hook.ts +19 -0
- package/src/hooks/Asta/Template/get/getTemplateQuery.hook.ts +2 -2
- package/src/hooks/index.ts +18 -0
- package/src/interfaces/Actions.ts +19 -0
- package/src/interfaces/AnswerType.ts +2 -0
- package/src/interfaces/index.ts +1 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UseQueryOptions } from "@tanstack/react-query";
|
|
2
|
+
import { Actions, ResponseList } from "../../../../interfaces";
|
|
3
|
+
export interface ActionQueryProps extends UseQueryOptions<ResponseList<"Value", Actions>> {
|
|
4
|
+
tags?: string;
|
|
5
|
+
page?: number;
|
|
6
|
+
records?: number;
|
|
7
|
+
sortBy?: string;
|
|
8
|
+
sortDirection?: string;
|
|
9
|
+
query?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const getActionQueryHook: ({ tags, page, records, sortBy, sortDirection, query }: ActionQueryProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"Value", Actions>, unknown>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import { Actions } from '../../../../interfaces';
|
|
3
|
+
export interface ActionTemplateProps extends UseQueryOptions<Actions> {
|
|
4
|
+
actionsIds: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare const archiveActionQueryHook: ({ actionsIds }: ActionTemplateProps) => import("@tanstack/react-query").UseMutationResult<Actions, unknown, string[], unknown>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import { Actions } from '../../../../interfaces';
|
|
3
|
+
export interface DeleteActionProps extends UseQueryOptions<Actions> {
|
|
4
|
+
actionsIds: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare const deleteActionMutateHook: ({ actionsIds }: DeleteActionProps) => import("@tanstack/react-query").UseMutationResult<Actions, unknown, string[], unknown>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import { Actions } from '../../../../interfaces';
|
|
3
|
+
export interface ExtractActionProps extends UseQueryOptions<Actions> {
|
|
4
|
+
actionsIds: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare const extractActionQueryHook: ({ actionsIds }: ExtractActionProps) => import("@tanstack/react-query").UseMutationResult<Actions, unknown, string[], unknown>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UseQueryOptions } from "@tanstack/react-query";
|
|
2
|
+
import { AnswerType, ResponseList } from "../../../../interfaces";
|
|
3
|
+
export interface AnswerTypeQueryProps extends UseQueryOptions<ResponseList<"Value", AnswerType>> {
|
|
4
|
+
tags?: string;
|
|
5
|
+
page?: number;
|
|
6
|
+
records?: number;
|
|
7
|
+
sortBy?: string;
|
|
8
|
+
sortDirection?: string;
|
|
9
|
+
query?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const getAllAnswerTypeQueryHook: ({ tags, page, records, sortBy, sortDirection, query }: AnswerTypeQueryProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"Value", AnswerType>, unknown>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import { AnswerType } from '../../../../interfaces';
|
|
3
|
+
export interface DeleteAnswerTypeProps extends UseQueryOptions<AnswerType> {
|
|
4
|
+
answerTypeIds: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare const deleteAnswerTypeHook: ({ answerTypeIds }: DeleteAnswerTypeProps) => import("@tanstack/react-query").UseMutationResult<AnswerType, unknown, string[], unknown>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UseQueryOptions } from "@tanstack/react-query";
|
|
2
2
|
import { Inspection, ResponseList } from "../../../../interfaces";
|
|
3
|
-
export interface InspectionQueryProps extends UseQueryOptions<ResponseList<"
|
|
3
|
+
export interface InspectionQueryProps extends UseQueryOptions<ResponseList<"Value", Inspection>> {
|
|
4
4
|
tags?: string;
|
|
5
5
|
page?: number;
|
|
6
6
|
records?: number;
|
|
@@ -8,4 +8,4 @@ export interface InspectionQueryProps extends UseQueryOptions<ResponseList<"Insp
|
|
|
8
8
|
sortDirection?: string;
|
|
9
9
|
query?: string;
|
|
10
10
|
}
|
|
11
|
-
export declare const getInspectionQueryHook: ({ tags, page, records, sortBy, sortDirection, query }: InspectionQueryProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"
|
|
11
|
+
export declare const getInspectionQueryHook: ({ tags, page, records, sortBy, sortDirection, query }: InspectionQueryProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"Value", Inspection>, unknown>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import { Inspection } from '../../../../interfaces';
|
|
3
|
+
export interface ArchiveInspectionProps extends UseQueryOptions<Inspection> {
|
|
4
|
+
inspectionIds: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare const archiveInspectionQueryHook: ({ inspectionIds }: ArchiveInspectionProps) => import("@tanstack/react-query").UseMutationResult<Inspection, unknown, string[], unknown>;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
1
2
|
import { Inspection } from '../../../../interfaces';
|
|
2
|
-
export
|
|
3
|
+
export interface DeleteInspectionProps extends UseQueryOptions<Inspection> {
|
|
4
|
+
inspectionIds: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare const deleteInspectionMutateHook: ({ inspectionIds }: DeleteInspectionProps) => import("@tanstack/react-query").UseMutationResult<Inspection, unknown, string[], unknown>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import { Inspection } from '../../../../interfaces';
|
|
3
|
+
export interface ExtractInspectionProps extends UseQueryOptions<Inspection> {
|
|
4
|
+
inspectionIds: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare const extractInspectionQueryHook: ({ inspectionIds }: ExtractInspectionProps) => import("@tanstack/react-query").UseMutationResult<Inspection, unknown, string[], unknown>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UseQueryOptions } from "@tanstack/react-query";
|
|
2
2
|
import { Template, ResponseList } from "../../../../interfaces";
|
|
3
|
-
export interface TemplateQueryProps extends UseQueryOptions<ResponseList<"
|
|
3
|
+
export interface TemplateQueryProps extends UseQueryOptions<ResponseList<"Value", Template>> {
|
|
4
4
|
tags?: string;
|
|
5
5
|
page?: number;
|
|
6
6
|
records?: number;
|
|
@@ -8,4 +8,4 @@ export interface TemplateQueryProps extends UseQueryOptions<ResponseList<"Templa
|
|
|
8
8
|
sortDirection?: string;
|
|
9
9
|
query?: string;
|
|
10
10
|
}
|
|
11
|
-
export declare const getTemplateQueryHook: ({ tags, page, records, sortBy, sortDirection, query }: TemplateQueryProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"
|
|
11
|
+
export declare const getTemplateQueryHook: ({ tags, page, records, sortBy, sortDirection, query }: TemplateQueryProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"Value", Template>, unknown>;
|
|
@@ -73,11 +73,28 @@ export * from './Asta/Inspection/get/getInspectionQuery.hook';
|
|
|
73
73
|
export * from './Asta/Inspection/mutate/useInspectionMutateQuery.hook';
|
|
74
74
|
export * from './Asta/Inspection/others/deleteInspectionQuery.hook';
|
|
75
75
|
export * from './Asta/Inspection/others/finishInspectionQuery.hook';
|
|
76
|
+
export * from './Asta/Inspection/others/archiveTemplateQuery.hook';
|
|
77
|
+
export * from './Asta/Inspection/others/extractTemplateQuery.hook';
|
|
76
78
|
export * from './Asta/Answer/get/getAstaAnswerQuery.hook';
|
|
77
79
|
export * from './Asta/Answer/mutate/useAstaAnswersMutateQuery.hook';
|
|
78
80
|
export * from './Asta/Answer/others/finishAstaAnswersQuery.hook';
|
|
79
81
|
export * from './Asta/Answer/others/putAnswerImageQuery.hook';
|
|
80
82
|
export * from './Asta/AnswerType/get/getAnswerTypeQuery.hook';
|
|
83
|
+
export * from './Asta/AnswerType/get/getAllAnswerTypeQuery.hook';
|
|
84
|
+
export * from './Asta/AnswerType/get/getAnswerColorsQuery.hook';
|
|
85
|
+
export * from './Asta/AnswerType/get/getAnswerTypeByIdQuery.hook';
|
|
86
|
+
export * from './Asta/AnswerType/mutate/useAnswerTypeMutateQuery.hook';
|
|
87
|
+
export * from './Asta/AnswerType/mutate/useAnswerTypeMutateQuery.hook';
|
|
88
|
+
export * from './Asta/AnswerType/others/deleteAnswerTypeQuery.hook';
|
|
89
|
+
export * from './Asta/AnswerType/others/finishAnswerTypeQuery.hook';
|
|
90
|
+
export * from './Asta/Actions/get/getActionByIdQuery.hook';
|
|
91
|
+
export * from './Asta/Actions/get/getActionPriorityQuery.hook';
|
|
92
|
+
export * from './Asta/Actions/get/getActionQuery.hook';
|
|
93
|
+
export * from './Asta/Actions/mutate/useActionMutateQuery.hook';
|
|
94
|
+
export * from './Asta/Actions/others/deleteActionQuery.hook';
|
|
95
|
+
export * from './Asta/Actions/others/extractActionQuery.hook';
|
|
96
|
+
export * from './Asta/Actions/others/archiveActionQuery.hook';
|
|
97
|
+
export * from './Asta/Actions/others/finishActionQuery.hook';
|
|
81
98
|
export * from './Others/useJobTitlesQuery.hook';
|
|
82
99
|
export * from './Others/useContractStatesQuery.hook';
|
|
83
100
|
export * from './Others/useApplicationDataQuery.hook';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface Actions {
|
|
2
|
+
Id: string;
|
|
3
|
+
Title: string;
|
|
4
|
+
Description: string;
|
|
5
|
+
UserName: string;
|
|
6
|
+
State: string;
|
|
7
|
+
Priority: string;
|
|
8
|
+
EndDate: number;
|
|
9
|
+
InspectionAnswer: any;
|
|
10
|
+
InspectionId: string;
|
|
11
|
+
InspectionName: string;
|
|
12
|
+
QuestionId: string;
|
|
13
|
+
QuestionName: string;
|
|
14
|
+
CreatedBy: string;
|
|
15
|
+
Answer: string;
|
|
16
|
+
Color: string;
|
|
17
|
+
QuestionAnswerId: string;
|
|
18
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useQuery } from "@tanstack/react-query";
|
|
2
|
+
import { Actions } from "../../../../interfaces";
|
|
3
|
+
import { getAuth0 } from "../../../../services/ApiService";
|
|
4
|
+
|
|
5
|
+
export const getActionByIdQueryHook = (actionId: string) => {
|
|
6
|
+
return useQuery(
|
|
7
|
+
['ACTION_ID_QUERY', actionId],
|
|
8
|
+
() => getAuth0<Actions>(`/ASTA/Actions/GetById`, {
|
|
9
|
+
pId: actionId
|
|
10
|
+
}),
|
|
11
|
+
{
|
|
12
|
+
enabled: !!(actionId),
|
|
13
|
+
},
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useQuery } from "@tanstack/react-query";
|
|
2
|
+
import { HeadersInterface } from "../../../../interfaces";
|
|
3
|
+
import { getAuth0 } from "../../../../services/ApiService";
|
|
4
|
+
|
|
5
|
+
export const getActionPriorityQueryHook = () => {
|
|
6
|
+
return useQuery(
|
|
7
|
+
['ACTION_PRIORITY_QUERY'],
|
|
8
|
+
() => getAuth0<HeadersInterface[]>(`/ASTA/Actions/Prioritys`),
|
|
9
|
+
);
|
|
10
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useQuery, UseQueryOptions } from "@tanstack/react-query";
|
|
2
|
+
import { Actions, ResponseList } from "../../../../interfaces";
|
|
3
|
+
import { getAuth0 } from "../../../../services/ApiService";
|
|
4
|
+
|
|
5
|
+
export interface ActionQueryProps extends UseQueryOptions<ResponseList<"Value", Actions>> {
|
|
6
|
+
tags?: string;
|
|
7
|
+
page?: number;
|
|
8
|
+
records?: number;
|
|
9
|
+
sortBy?: string;
|
|
10
|
+
sortDirection?: string;
|
|
11
|
+
query?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const getActionQueryHook = ({ tags, page, records, sortBy, sortDirection, query }: ActionQueryProps) => {
|
|
15
|
+
return useQuery(
|
|
16
|
+
['ACTION_QUERY', tags, page, records, sortBy, sortDirection, query],
|
|
17
|
+
() => getAuth0<ResponseList<"Value", Actions>>('/ASTA/Actions/GetByQuery', {
|
|
18
|
+
pPage: page || 1,
|
|
19
|
+
pRecords: records || 50,
|
|
20
|
+
pSortBy: sortBy || 'Type',
|
|
21
|
+
pSortDirection: sortDirection || 'asc',
|
|
22
|
+
pTerms: tags,
|
|
23
|
+
pQuery: query
|
|
24
|
+
}),
|
|
25
|
+
{
|
|
26
|
+
keepPreviousData: true,
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { Actions } from '../../../../interfaces';
|
|
3
|
+
import { putAuth0, postAuth0 } from '../../../../services/ApiService';
|
|
4
|
+
|
|
5
|
+
export const useActionMutateHook = () => {
|
|
6
|
+
const queryClient = useQueryClient();
|
|
7
|
+
return useMutation<Actions, unknown, Actions>((data: Actions) => {
|
|
8
|
+
return data.Id ?
|
|
9
|
+
putAuth0(`/ASTA/Actions?`, {
|
|
10
|
+
pId: data.Id
|
|
11
|
+
}, data)
|
|
12
|
+
|
|
13
|
+
: postAuth0('/ASTA/Actions', undefined, data);
|
|
14
|
+
}, {
|
|
15
|
+
onSuccess: (data: Actions) => {
|
|
16
|
+
queryClient.setQueryData(
|
|
17
|
+
['ACTIONS_ID_QUERY'], data);
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { UseQueryOptions, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { Actions } from '../../../../interfaces';
|
|
3
|
+
import { putAuth0 } from '../../../../services/ApiService';
|
|
4
|
+
|
|
5
|
+
export interface ActionTemplateProps extends UseQueryOptions<Actions> {
|
|
6
|
+
actionsIds: string[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const archiveActionQueryHook = ({ actionsIds }: ActionTemplateProps) => {
|
|
10
|
+
const queryClient = useQueryClient();
|
|
11
|
+
return useMutation<Actions, unknown, string[]>(() => {
|
|
12
|
+
return putAuth0(`/ASTA/Actions/FileActionList`, undefined, actionsIds);
|
|
13
|
+
}, {
|
|
14
|
+
onSuccess: (data: Actions) => {
|
|
15
|
+
queryClient.setQueryData(
|
|
16
|
+
['ACTION_ID_QUERY'], data);
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { UseQueryOptions, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { Actions } from '../../../../interfaces';
|
|
3
|
+
import { toDeleteAuth0 } from '../../../../services/ApiService';
|
|
4
|
+
|
|
5
|
+
export interface DeleteActionProps extends UseQueryOptions<Actions> {
|
|
6
|
+
actionsIds: string[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const deleteActionMutateHook = ({ actionsIds }: DeleteActionProps) => {
|
|
10
|
+
const queryClient = useQueryClient();
|
|
11
|
+
return useMutation<Actions, unknown, string[]>(() => {
|
|
12
|
+
return toDeleteAuth0(`/ASTA/Actions/DeleteActionList`, undefined, actionsIds)
|
|
13
|
+
}, {
|
|
14
|
+
onSuccess: () => {
|
|
15
|
+
queryClient.invalidateQueries(
|
|
16
|
+
['ACTION_QUERY']);
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { UseQueryOptions, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { Actions } from '../../../../interfaces';
|
|
3
|
+
import { putAuth0 } from '../../../../services/ApiService';
|
|
4
|
+
|
|
5
|
+
export interface ExtractActionProps extends UseQueryOptions<Actions> {
|
|
6
|
+
actionsIds: string[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const extractActionQueryHook = ({ actionsIds }: ExtractActionProps) => {
|
|
10
|
+
const queryClient = useQueryClient();
|
|
11
|
+
return useMutation<Actions, unknown, string[]>(() => {
|
|
12
|
+
return putAuth0(`/ASTA/Actions/FinishedActionList`, undefined, actionsIds)
|
|
13
|
+
}, {
|
|
14
|
+
onSuccess: (data: Actions) => {
|
|
15
|
+
queryClient.setQueryData(
|
|
16
|
+
['ACTION_ID_QUERY'], data);
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { Actions } from '../../../../interfaces';
|
|
3
|
+
import { putAuth0 } from '../../../../services/ApiService';
|
|
4
|
+
|
|
5
|
+
export const finishActionQueryHook = () => {
|
|
6
|
+
const queryClient = useQueryClient();
|
|
7
|
+
return useMutation<Actions, unknown, Actions>((data: Actions) => {
|
|
8
|
+
return putAuth0(`/ASTA/Actions/FinishAction?`, {
|
|
9
|
+
pId: data.Id
|
|
10
|
+
}, data);
|
|
11
|
+
}, {
|
|
12
|
+
onSuccess: (data: Actions) => {
|
|
13
|
+
queryClient.setQueryData(
|
|
14
|
+
['ACTION_ID_QUERY'], data);
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useQuery, UseQueryOptions } from "@tanstack/react-query";
|
|
2
|
+
import { AnswerType, ResponseList } from "../../../../interfaces";
|
|
3
|
+
import { getAuth0 } from "../../../../services/ApiService";
|
|
4
|
+
|
|
5
|
+
export interface AnswerTypeQueryProps extends UseQueryOptions<ResponseList<"Value", AnswerType>> {
|
|
6
|
+
tags?: string;
|
|
7
|
+
page?: number;
|
|
8
|
+
records?: number;
|
|
9
|
+
sortBy?: string;
|
|
10
|
+
sortDirection?: string;
|
|
11
|
+
query?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const getAllAnswerTypeQueryHook = ({ tags, page, records, sortBy, sortDirection, query }: AnswerTypeQueryProps) => {
|
|
15
|
+
return useQuery(
|
|
16
|
+
['ALL_ANSWER_TYPE_QUERY', tags, page, records, sortBy, sortDirection, query],
|
|
17
|
+
() => getAuth0<ResponseList<"Value", AnswerType>>('/ASTA/AnswerType/GetByQuery', {
|
|
18
|
+
pPage: page || 1,
|
|
19
|
+
pRecords: records || 50,
|
|
20
|
+
pSortBy: sortBy || 'Type',
|
|
21
|
+
pSortDirection: sortDirection || 'asc',
|
|
22
|
+
pTerms: tags,
|
|
23
|
+
pQuery: query
|
|
24
|
+
}),
|
|
25
|
+
{
|
|
26
|
+
keepPreviousData: true,
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useQuery } from "@tanstack/react-query";
|
|
2
|
+
import { HeadersInterface } from "../../../../interfaces";
|
|
3
|
+
import { getAuth0 } from "../../../../services/ApiService";
|
|
4
|
+
|
|
5
|
+
export const getAnswerColorsQueryHook = () => {
|
|
6
|
+
return useQuery(
|
|
7
|
+
['ANSWER_COLORS_QUERY'],
|
|
8
|
+
() => getAuth0<HeadersInterface[]>(`/ASTA/AnswerType/Colors`),
|
|
9
|
+
);
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useQuery } from "@tanstack/react-query";
|
|
2
|
+
import { AnswerType } from "../../../../interfaces";
|
|
3
|
+
import { getAuth0 } from "../../../../services/ApiService";
|
|
4
|
+
|
|
5
|
+
export const getAnswerTypeByIdQueryHook = (answerTypeId: string) => {
|
|
6
|
+
return useQuery(
|
|
7
|
+
['ANSWER_TYPE_ID_QUERY', answerTypeId],
|
|
8
|
+
() => getAuth0<AnswerType>(`/ASTA/AnswerType/GetById`, {
|
|
9
|
+
pId: answerTypeId
|
|
10
|
+
}),
|
|
11
|
+
{
|
|
12
|
+
enabled: !!(answerTypeId),
|
|
13
|
+
},
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { AnswerType } from '../../../../interfaces';
|
|
3
|
+
import { putAuth0, postAuth0 } from '../../../../services/ApiService';
|
|
4
|
+
|
|
5
|
+
export const useAnswerTypeMutateHook = () => {
|
|
6
|
+
const queryClient = useQueryClient();
|
|
7
|
+
return useMutation<AnswerType, unknown, AnswerType>((data: AnswerType) => {
|
|
8
|
+
return data.Id ?
|
|
9
|
+
putAuth0(`/ASTA/AnswerType?`, {
|
|
10
|
+
pId: data.Id
|
|
11
|
+
}, data)
|
|
12
|
+
|
|
13
|
+
: postAuth0('/ASTA/AnswerType', undefined, data);
|
|
14
|
+
}, {
|
|
15
|
+
onSuccess: (data: AnswerType) => {
|
|
16
|
+
queryClient.setQueryData(
|
|
17
|
+
['ANSWER_TYPE_ID_QUERY'], data);
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { UseQueryOptions, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { AnswerType } from '../../../../interfaces';
|
|
3
|
+
import { toDeleteAuth0 } from '../../../../services/ApiService';
|
|
4
|
+
|
|
5
|
+
export interface DeleteAnswerTypeProps extends UseQueryOptions<AnswerType> {
|
|
6
|
+
answerTypeIds: string[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const deleteAnswerTypeHook = ({ answerTypeIds }: DeleteAnswerTypeProps) => {
|
|
10
|
+
const queryClient = useQueryClient();
|
|
11
|
+
return useMutation<AnswerType, unknown, string[]>(() => {
|
|
12
|
+
return toDeleteAuth0(`/ASTA/AnswerType/Delete`, undefined, answerTypeIds)
|
|
13
|
+
}, {
|
|
14
|
+
onSuccess: () => {
|
|
15
|
+
queryClient.invalidateQueries(
|
|
16
|
+
['ALL_ANSWER_TYPE_QUERY']);
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { AnswerType } from '../../../../interfaces';
|
|
3
|
+
import { putAuth0 } from '../../../../services/ApiService';
|
|
4
|
+
|
|
5
|
+
export const finishAnswerTypeQueryHook = () => {
|
|
6
|
+
const queryClient = useQueryClient();
|
|
7
|
+
return useMutation<AnswerType, unknown, AnswerType>((data: AnswerType) => {
|
|
8
|
+
return putAuth0(`/ASTA/AnswerType/Finished?`, {
|
|
9
|
+
pId: data.Id
|
|
10
|
+
}, data);
|
|
11
|
+
}, {
|
|
12
|
+
onSuccess: (data: AnswerType) => {
|
|
13
|
+
queryClient.setQueryData(
|
|
14
|
+
['ANSWER_TYPE_ID_QUERY'], data);
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -2,7 +2,7 @@ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
|
|
|
2
2
|
import { Inspection, ResponseList } from "../../../../interfaces";
|
|
3
3
|
import { getAuth0 } from "../../../../services/ApiService";
|
|
4
4
|
|
|
5
|
-
export interface InspectionQueryProps extends UseQueryOptions<ResponseList<"
|
|
5
|
+
export interface InspectionQueryProps extends UseQueryOptions<ResponseList<"Value", Inspection>> {
|
|
6
6
|
tags?: string;
|
|
7
7
|
page?: number;
|
|
8
8
|
records?: number;
|
|
@@ -14,7 +14,7 @@ export interface InspectionQueryProps extends UseQueryOptions<ResponseList<"Insp
|
|
|
14
14
|
export const getInspectionQueryHook = ({ tags, page, records, sortBy, sortDirection, query }: InspectionQueryProps) => {
|
|
15
15
|
return useQuery(
|
|
16
16
|
['INSPECTION_QUERY', tags, page, records, sortBy, sortDirection, query],
|
|
17
|
-
() => getAuth0<ResponseList<"
|
|
17
|
+
() => getAuth0<ResponseList<"Value", Inspection>>('/ASTA/Inspection/GetInspection', {
|
|
18
18
|
pPage: page || 1,
|
|
19
19
|
pRecords: records || 50,
|
|
20
20
|
pSortBy: sortBy || 'Type',
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { UseQueryOptions, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { Inspection } from '../../../../interfaces';
|
|
3
|
+
import { putAuth0 } from '../../../../services/ApiService';
|
|
4
|
+
|
|
5
|
+
export interface ArchiveInspectionProps extends UseQueryOptions<Inspection> {
|
|
6
|
+
inspectionIds: string[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const archiveInspectionQueryHook = ({ inspectionIds }: ArchiveInspectionProps) => {
|
|
10
|
+
const queryClient = useQueryClient();
|
|
11
|
+
return useMutation<Inspection, unknown, string[]>(() => {
|
|
12
|
+
return putAuth0(`/ASTA/Inspection/FileInspectionList`, undefined, inspectionIds);
|
|
13
|
+
}, {
|
|
14
|
+
onSuccess: (data: Inspection) => {
|
|
15
|
+
queryClient.setQueryData(
|
|
16
|
+
['INSPECTION_ID_QUERY'], data);
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
1
|
+
import { UseQueryOptions, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
2
|
import { Inspection } from '../../../../interfaces';
|
|
3
3
|
import { toDeleteAuth0 } from '../../../../services/ApiService';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export interface DeleteInspectionProps extends UseQueryOptions<Inspection> {
|
|
6
|
+
inspectionIds: string[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const deleteInspectionMutateHook = ({ inspectionIds }: DeleteInspectionProps) => {
|
|
6
10
|
const queryClient = useQueryClient();
|
|
7
|
-
return useMutation<Inspection, unknown,
|
|
8
|
-
return toDeleteAuth0(`/ASTA/Inspection/
|
|
11
|
+
return useMutation<Inspection, unknown, string[]>(() => {
|
|
12
|
+
return toDeleteAuth0(`/ASTA/Inspection/DeleteInspectionList`, undefined, inspectionIds)
|
|
9
13
|
}, {
|
|
10
14
|
onSuccess: () => {
|
|
11
15
|
queryClient.invalidateQueries(
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { UseQueryOptions, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { Inspection } from '../../../../interfaces';
|
|
3
|
+
import { putAuth0 } from '../../../../services/ApiService';
|
|
4
|
+
|
|
5
|
+
export interface ExtractInspectionProps extends UseQueryOptions<Inspection> {
|
|
6
|
+
inspectionIds: string[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const extractInspectionQueryHook = ({ inspectionIds }: ExtractInspectionProps) => {
|
|
10
|
+
const queryClient = useQueryClient();
|
|
11
|
+
return useMutation<Inspection, unknown, string[]>(() => {
|
|
12
|
+
return putAuth0(`/ASTA/Inspection/FinishedInspectionList`, undefined, inspectionIds)
|
|
13
|
+
}, {
|
|
14
|
+
onSuccess: (data: Inspection) => {
|
|
15
|
+
queryClient.setQueryData(
|
|
16
|
+
['INSPECTION_ID_QUERY'], data);
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -2,7 +2,7 @@ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
|
|
|
2
2
|
import { Template, ResponseList } from "../../../../interfaces";
|
|
3
3
|
import { getAuth0 } from "../../../../services/ApiService";
|
|
4
4
|
|
|
5
|
-
export interface TemplateQueryProps extends UseQueryOptions<ResponseList<"
|
|
5
|
+
export interface TemplateQueryProps extends UseQueryOptions<ResponseList<"Value", Template>> {
|
|
6
6
|
tags?: string;
|
|
7
7
|
page?: number;
|
|
8
8
|
records?: number;
|
|
@@ -14,7 +14,7 @@ export interface TemplateQueryProps extends UseQueryOptions<ResponseList<"Templa
|
|
|
14
14
|
export const getTemplateQueryHook = ({ tags, page, records, sortBy, sortDirection, query }: TemplateQueryProps) => {
|
|
15
15
|
return useQuery(
|
|
16
16
|
['TEMPLATES_QUERY', tags, page, records, sortBy, sortDirection, query],
|
|
17
|
-
() => getAuth0<ResponseList<"
|
|
17
|
+
() => getAuth0<ResponseList<"Value", Template>>('/ASTA/Template/GetByQuery', {
|
|
18
18
|
pPage: page || 1,
|
|
19
19
|
pRecords: records || 50,
|
|
20
20
|
pSortBy: sortBy || 'Type',
|