@omniumretail/shared-resources 0.1.80 → 0.1.82
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/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 +10 -0
- package/dist/types/interfaces/Actions.d.ts +18 -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/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/Asta/Template/mutate/useTemplateMutateQuery.hook.ts +1 -1
- package/src/hooks/index.ts +11 -0
- package/src/interfaces/Actions.ts +19 -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>;
|
|
@@ -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,21 @@ 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/Actions/get/getActionByIdQuery.hook';
|
|
84
|
+
export * from './Asta/Actions/get/getActionPriorityQuery.hook';
|
|
85
|
+
export * from './Asta/Actions/get/getActionQuery.hook';
|
|
86
|
+
export * from './Asta/Actions/mutate/useActionMutateQuery.hook';
|
|
87
|
+
export * from './Asta/Actions/others/deleteActionQuery.hook';
|
|
88
|
+
export * from './Asta/Actions/others/extractActionQuery.hook';
|
|
89
|
+
export * from './Asta/Actions/others/archiveActionQuery.hook';
|
|
90
|
+
export * from './Asta/Actions/others/finishActionQuery.hook';
|
|
81
91
|
export * from './Others/useJobTitlesQuery.hook';
|
|
82
92
|
export * from './Others/useContractStatesQuery.hook';
|
|
83
93
|
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
|
+
}
|
|
@@ -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',
|
|
@@ -6,7 +6,7 @@ export const useTemplateMutateHook = () => {
|
|
|
6
6
|
const queryClient = useQueryClient();
|
|
7
7
|
return useMutation<Template, unknown, Template>((data: Template) => {
|
|
8
8
|
return data.Id ?
|
|
9
|
-
putAuth0(`/ASTA/Template
|
|
9
|
+
putAuth0(`/ASTA/Template?`, {
|
|
10
10
|
pId: data.Id
|
|
11
11
|
}, data)
|
|
12
12
|
|
package/src/hooks/index.ts
CHANGED
|
@@ -97,6 +97,8 @@ export * from './Asta/Inspection/get/getInspectionQuery.hook';
|
|
|
97
97
|
export * from './Asta/Inspection/mutate/useInspectionMutateQuery.hook';
|
|
98
98
|
export * from './Asta/Inspection/others/deleteInspectionQuery.hook';
|
|
99
99
|
export * from './Asta/Inspection/others/finishInspectionQuery.hook';
|
|
100
|
+
export * from './Asta/Inspection/others/archiveTemplateQuery.hook';
|
|
101
|
+
export * from './Asta/Inspection/others/extractTemplateQuery.hook';
|
|
100
102
|
|
|
101
103
|
export * from './Asta/Answer/get/getAstaAnswerQuery.hook';
|
|
102
104
|
export * from './Asta/Answer/mutate/useAstaAnswersMutateQuery.hook';
|
|
@@ -105,6 +107,15 @@ export * from './Asta/Answer/others/putAnswerImageQuery.hook';
|
|
|
105
107
|
|
|
106
108
|
export * from './Asta/AnswerType/get/getAnswerTypeQuery.hook';
|
|
107
109
|
|
|
110
|
+
export * from './Asta/Actions/get/getActionByIdQuery.hook';
|
|
111
|
+
export * from './Asta/Actions/get/getActionPriorityQuery.hook';
|
|
112
|
+
export * from './Asta/Actions/get/getActionQuery.hook';
|
|
113
|
+
export * from './Asta/Actions/mutate/useActionMutateQuery.hook';
|
|
114
|
+
export * from './Asta/Actions/others/deleteActionQuery.hook';
|
|
115
|
+
export * from './Asta/Actions/others/extractActionQuery.hook';
|
|
116
|
+
export * from './Asta/Actions/others/archiveActionQuery.hook';
|
|
117
|
+
export * from './Asta/Actions/others/finishActionQuery.hook';
|
|
118
|
+
|
|
108
119
|
//Others
|
|
109
120
|
export * from './Others/useJobTitlesQuery.hook';
|
|
110
121
|
export * from './Others/useContractStatesQuery.hook';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
export interface Actions {
|
|
3
|
+
Id: string;
|
|
4
|
+
Title: string;
|
|
5
|
+
Description: string;
|
|
6
|
+
UserName: string;
|
|
7
|
+
State: string;
|
|
8
|
+
Priority: string;
|
|
9
|
+
EndDate: number;
|
|
10
|
+
InspectionAnswer: any;
|
|
11
|
+
InspectionId: string;
|
|
12
|
+
InspectionName: string;
|
|
13
|
+
QuestionId: string;
|
|
14
|
+
QuestionName: string;
|
|
15
|
+
CreatedBy: string;
|
|
16
|
+
Answer: string;
|
|
17
|
+
Color: string;
|
|
18
|
+
QuestionAnswerId: string;
|
|
19
|
+
}
|
package/src/interfaces/index.ts
CHANGED