@omniumretail/shared-resources 0.1.62 → 0.1.63
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/ATIM/PicaPonto/mutate/postAttendance.hook.d.ts +3 -5
- package/dist/types/hooks/ATIM/PicaPonto/mutate/postTogglePinCode.d.ts +4 -4
- package/dist/types/interfaces/Responses.d.ts +10 -0
- package/dist/types/interfaces/index.d.ts +3 -0
- package/package.json +1 -1
- package/src/hooks/ATIM/PicaPonto/mutate/postAttendance.hook.ts +14 -17
- package/src/hooks/ATIM/PicaPonto/mutate/postTogglePinCode.ts +4 -4
- package/src/interfaces/Responses.ts +16 -1
- package/src/interfaces/index.ts +3 -0
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export interface PostAttendance extends UseQueryOptions<TogglePinCode> {
|
|
2
|
+
import { Attendance } from "../../../../interfaces";
|
|
3
|
+
export interface PostAttendance extends UseQueryOptions<Attendance> {
|
|
5
4
|
storeId: string;
|
|
6
5
|
employeeId: string;
|
|
7
6
|
isWorking: boolean;
|
|
8
|
-
type: AttendanceType;
|
|
9
7
|
}
|
|
10
|
-
export declare const usePostAttendance: ({ storeId, employeeId,
|
|
8
|
+
export declare const usePostAttendance: ({ storeId, employeeId, isWorking }: PostAttendance) => import("@tanstack/react-query").UseMutationResult<Attendance, unknown, Attendance, unknown>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
2
|
import { TogglePinCode } from "../../../../interfaces/Responses";
|
|
3
3
|
interface TogglePinCodeMutateProps extends UseQueryOptions<TogglePinCode> {
|
|
4
|
-
pinCode
|
|
5
|
-
storeId
|
|
6
|
-
employeeId
|
|
7
|
-
isWorking
|
|
4
|
+
pinCode: string;
|
|
5
|
+
storeId: string;
|
|
6
|
+
employeeId: string;
|
|
7
|
+
isWorking: boolean;
|
|
8
8
|
}
|
|
9
9
|
export declare const postTogglePinCode: ({ pinCode, storeId, employeeId, isWorking }: TogglePinCodeMutateProps) => import("@tanstack/react-query").UseMutationResult<TogglePinCode, unknown, TogglePinCode, unknown>;
|
|
10
10
|
export {};
|
|
@@ -11,3 +11,13 @@ export interface TogglePinCode {
|
|
|
11
11
|
error?: string[];
|
|
12
12
|
success: boolean;
|
|
13
13
|
}
|
|
14
|
+
export interface Attendance {
|
|
15
|
+
Id: string;
|
|
16
|
+
StoreId: string;
|
|
17
|
+
EmployeeId: string;
|
|
18
|
+
Date: string;
|
|
19
|
+
Type: number;
|
|
20
|
+
Status: string;
|
|
21
|
+
CreateDate: string;
|
|
22
|
+
UpdateDate: string;
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
import { UseQueryOptions, useMutation
|
|
2
|
-
import { TogglePinCode } from "../../../../interfaces
|
|
1
|
+
import { useQueryClient, UseQueryOptions, useMutation } from '@tanstack/react-query';
|
|
2
|
+
import { Attendance, TogglePinCode } from "../../../../interfaces";
|
|
3
3
|
import { AttendanceType} from "../../../../enums/attendence-type.enum";
|
|
4
4
|
import { getDateToUnix } from "../../../../helpers/date-unix.helper";
|
|
5
5
|
import { postAuth0} from "../../../../services/ApiService";
|
|
6
6
|
|
|
7
|
-
export interface PostAttendance extends UseQueryOptions<
|
|
7
|
+
export interface PostAttendance extends UseQueryOptions<Attendance>{
|
|
8
8
|
storeId: string;
|
|
9
9
|
employeeId: string;
|
|
10
10
|
isWorking: boolean;
|
|
11
|
-
type: AttendanceType;
|
|
12
|
-
|
|
13
11
|
}
|
|
14
12
|
|
|
15
|
-
export const usePostAttendance = ({ storeId, employeeId,
|
|
13
|
+
export const usePostAttendance = ({ storeId, employeeId, isWorking}: PostAttendance) => {
|
|
16
14
|
const queryClient = useQueryClient();
|
|
17
|
-
return useMutation<
|
|
18
|
-
return postAuth0(
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
return useMutation<Attendance, unknown, Attendance>((data: Attendance) => {
|
|
16
|
+
return postAuth0('/Attendances', {
|
|
17
|
+
StoreId: storeId,
|
|
18
|
+
EmployeeId: employeeId,
|
|
21
19
|
Date: getDateToUnix(new Date()),
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
Type: isWorking ? AttendanceType.ENTER : AttendanceType.EXIT
|
|
21
|
+
|
|
22
|
+
}, data);
|
|
25
23
|
}, {
|
|
26
|
-
onSuccess: (data:
|
|
24
|
+
onSuccess: (data: Attendance) => {
|
|
27
25
|
queryClient.setQueryData(
|
|
28
|
-
['
|
|
29
|
-
}
|
|
30
|
-
|
|
26
|
+
['POST_ATTENDANCE'], data);
|
|
27
|
+
},
|
|
31
28
|
});
|
|
32
29
|
}
|
|
@@ -3,10 +3,10 @@ import { TogglePinCode } from "../../../../interfaces/Responses";
|
|
|
3
3
|
import { postAuth0 } from "../../../../services/ApiService";
|
|
4
4
|
|
|
5
5
|
interface TogglePinCodeMutateProps extends UseQueryOptions<TogglePinCode>{
|
|
6
|
-
pinCode
|
|
7
|
-
storeId
|
|
8
|
-
employeeId
|
|
9
|
-
isWorking
|
|
6
|
+
pinCode: string;
|
|
7
|
+
storeId: string;
|
|
8
|
+
employeeId: string;
|
|
9
|
+
isWorking: boolean;
|
|
10
10
|
}
|
|
11
11
|
export const postTogglePinCode = ({pinCode, storeId, employeeId, isWorking }: TogglePinCodeMutateProps) => {
|
|
12
12
|
const queryClient = useQueryClient();
|
|
@@ -2,6 +2,7 @@ import { Employee} from './Employee';
|
|
|
2
2
|
import { WorkLog } from './TimeKeeping';
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
//Response Interfaces
|
|
6
7
|
|
|
7
8
|
export interface EmployeeTimeKeeping {
|
|
@@ -12,12 +13,26 @@ export interface EmployeeTimeKeeping {
|
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export interface TogglePinCode {
|
|
15
|
-
|
|
16
16
|
workLog?: WorkLog;
|
|
17
17
|
error?: string[];
|
|
18
18
|
success: boolean;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
export interface Attendance {
|
|
22
|
+
Id: string;
|
|
23
|
+
StoreId: string;
|
|
24
|
+
EmployeeId: string;
|
|
25
|
+
Date: string;
|
|
26
|
+
Type: number;
|
|
27
|
+
Status: string;
|
|
28
|
+
CreateDate: string;
|
|
29
|
+
UpdateDate: string;
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
21
36
|
|
|
22
37
|
|
|
23
38
|
|