@managesome/eposmatic-toolkit 0.4.20 → 0.4.21

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.
@@ -24,6 +24,12 @@ export var HR_CHECK_IN_METHOD_ENUM;
24
24
  HR_CHECK_IN_METHOD_ENUM["QR"] = "QR";
25
25
  })(HR_CHECK_IN_METHOD_ENUM || (HR_CHECK_IN_METHOD_ENUM = {}));
26
26
  export const ALL_HR_CHECK_IN_METHOD_NAMES = Object.values(HR_CHECK_IN_METHOD_ENUM);
27
+ export var HR_CLOCK_TIME_TYPE_ENUM;
28
+ (function (HR_CLOCK_TIME_TYPE_ENUM) {
29
+ HR_CLOCK_TIME_TYPE_ENUM["CHECK_IN"] = "CHECK_IN";
30
+ HR_CLOCK_TIME_TYPE_ENUM["CHECK_OUT"] = "CHECK_OUT";
31
+ })(HR_CLOCK_TIME_TYPE_ENUM || (HR_CLOCK_TIME_TYPE_ENUM = {}));
32
+ export const ALL_HR_CLOCK_TIME_TYPE_NAMES = Object.values(HR_CLOCK_TIME_TYPE_ENUM);
27
33
  export var HR_BIOMETRIC_ENROLLMENT_TYPE_ENUM;
28
34
  (function (HR_BIOMETRIC_ENROLLMENT_TYPE_ENUM) {
29
35
  HR_BIOMETRIC_ENROLLMENT_TYPE_ENUM["FINGERPRINT"] = "FINGERPRINT";
@@ -1,13 +1,34 @@
1
1
  import { Schema } from 'mongoose';
2
- import { ALL_HR_ATTENDANCE_STATUS_NAMES, ALL_HR_CHECK_IN_METHOD_NAMES, HR_ATTENDANCE_STATUS_ENUM, } from '../../constants';
2
+ import { ALL_HR_ATTENDANCE_STATUS_NAMES, ALL_HR_CHECK_IN_METHOD_NAMES, ALL_HR_CLOCK_TIME_TYPE_NAMES, HR_ATTENDANCE_STATUS_ENUM, } from '../../constants';
3
3
  const hrBreakTimeSchema = new Schema({
4
4
  start_time: {
5
5
  type: Number,
6
6
  required: true,
7
+ min: 0,
8
+ max: 86399,
7
9
  },
8
10
  end_time: {
9
11
  type: Number,
10
12
  default: null,
13
+ min: 0,
14
+ max: 86399,
15
+ },
16
+ }, { _id: false, minimize: false });
17
+ const hrClockTimeSchema = new Schema({
18
+ type: {
19
+ type: String,
20
+ required: true,
21
+ enum: ALL_HR_CLOCK_TIME_TYPE_NAMES,
22
+ },
23
+ time: {
24
+ type: Number,
25
+ required: true,
26
+ min: 0,
27
+ },
28
+ method: {
29
+ type: String,
30
+ enum: ALL_HR_CHECK_IN_METHOD_NAMES,
31
+ default: null,
11
32
  },
12
33
  }, { _id: false, minimize: false });
13
34
  export const TenantHrAttendanceRecordSchema = new Schema({
@@ -28,23 +49,24 @@ export const TenantHrAttendanceRecordSchema = new Schema({
28
49
  immutable: true,
29
50
  ref: 'tenant_hr_employees',
30
51
  },
31
- clock_in: {
32
- type: Date,
33
- default: null,
52
+ attendance_date: {
53
+ type: String,
54
+ required: true,
55
+ match: /^\d{4}-\d{2}-\d{2}$/,
34
56
  },
35
- clock_out: {
36
- type: Date,
37
- default: null,
57
+ clock_time: {
58
+ type: [hrClockTimeSchema],
59
+ default: [],
38
60
  },
39
61
  break_time: {
40
62
  type: [hrBreakTimeSchema],
41
63
  default: [],
42
64
  },
43
- total_break_minutes: {
65
+ total_break_time: {
44
66
  type: Number,
45
67
  default: 0,
46
68
  },
47
- total_hours: {
69
+ total_worked_time: {
48
70
  type: Number,
49
71
  default: 0,
50
72
  },
@@ -54,16 +76,6 @@ export const TenantHrAttendanceRecordSchema = new Schema({
54
76
  enum: ALL_HR_ATTENDANCE_STATUS_NAMES,
55
77
  default: HR_ATTENDANCE_STATUS_ENUM.PRESENT,
56
78
  },
57
- check_in_method: {
58
- type: String,
59
- enum: ALL_HR_CHECK_IN_METHOD_NAMES,
60
- default: null,
61
- },
62
- check_out_method: {
63
- type: String,
64
- enum: ALL_HR_CHECK_IN_METHOD_NAMES,
65
- default: null,
66
- },
67
79
  notes: {
68
80
  type: String,
69
81
  default: null,
@@ -84,4 +96,6 @@ export const TenantHrAttendanceRecordSchema = new Schema({
84
96
  versionKey: false,
85
97
  minimize: false,
86
98
  });
99
+ TenantHrAttendanceRecordSchema.index({ tenant_id: 1, employee_id: 1, attendance_date: 1 }, { unique: true });
100
+ TenantHrAttendanceRecordSchema.index({ tenant_id: 1, attendance_date: 1 });
87
101
  export const TENANT_HR_ATTENDANCE_RECORDS_COLLECTION_NAME = 'tenant_hr_attendance_records';
@@ -20,6 +20,11 @@ export declare enum HR_CHECK_IN_METHOD_ENUM {
20
20
  QR = "QR"
21
21
  }
22
22
  export declare const ALL_HR_CHECK_IN_METHOD_NAMES: HR_CHECK_IN_METHOD_ENUM[];
23
+ export declare enum HR_CLOCK_TIME_TYPE_ENUM {
24
+ CHECK_IN = "CHECK_IN",
25
+ CHECK_OUT = "CHECK_OUT"
26
+ }
27
+ export declare const ALL_HR_CLOCK_TIME_TYPE_NAMES: HR_CLOCK_TIME_TYPE_ENUM[];
23
28
  export declare enum HR_BIOMETRIC_ENROLLMENT_TYPE_ENUM {
24
29
  FINGERPRINT = "FINGERPRINT",
25
30
  FACE = "FACE"
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // Auto-split from constants/ENUMS.ts — see ENUMS.ts barrel for exports.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.ALL_HR_REVIEW_TYPE_NAMES = exports.HR_REVIEW_TYPE_ENUM = exports.DEFAULT_HR_LEAVE_ALLOWANCE = exports.ALL_HR_LEAVE_STATUS_NAMES = exports.HR_LEAVE_STATUS_ENUM = exports.ALL_HR_LEAVE_TYPE_NAMES = exports.HR_LEAVE_TYPE_ENUM = exports.ALL_HR_POLICY_STATUS_NAMES = exports.HR_POLICY_STATUS_ENUM = exports.ALL_HR_DOCUMENT_STATUS_NAMES = exports.HR_DOCUMENT_STATUS_ENUM = exports.ALL_HR_DOCUMENT_TYPE_NAMES = exports.HR_DOCUMENT_TYPE_ENUM = exports.ALL_HR_PAYMENT_METHOD_NAMES = exports.HR_PAYMENT_METHOD_ENUM = exports.ALL_HR_PAYROLL_STATUS_NAMES = exports.HR_PAYROLL_STATUS_ENUM = exports.ALL_HR_PAY_TYPE_NAMES = exports.HR_PAY_TYPE_ENUM = exports.ALL_HR_EMPLOYEE_DOCUMENT_TYPES = exports.HR_EMPLOYEE_DOCUMENT_TYPE_ENUM = exports.ALL_HR_SHIFT_STATUS_NAMES = exports.HR_SHIFT_STATUS_ENUM = exports.ALL_HR_SHIFT_TYPE_NAMES = exports.HR_SHIFT_TYPE_ENUM = exports.ALL_HR_BIOMETRIC_ENROLLMENT_TYPE_NAMES = exports.HR_BIOMETRIC_ENROLLMENT_TYPE_ENUM = exports.ALL_HR_CHECK_IN_METHOD_NAMES = exports.HR_CHECK_IN_METHOD_ENUM = exports.ALL_HR_ATTENDANCE_STATUS_NAMES = exports.HR_ATTENDANCE_STATUS_ENUM = exports.ALL_HR_EMPLOYMENT_STATUS_NAMES = exports.HR_EMPLOYMENT_STATUS_ENUM = void 0;
4
+ exports.ALL_HR_REVIEW_TYPE_NAMES = exports.HR_REVIEW_TYPE_ENUM = exports.DEFAULT_HR_LEAVE_ALLOWANCE = exports.ALL_HR_LEAVE_STATUS_NAMES = exports.HR_LEAVE_STATUS_ENUM = exports.ALL_HR_LEAVE_TYPE_NAMES = exports.HR_LEAVE_TYPE_ENUM = exports.ALL_HR_POLICY_STATUS_NAMES = exports.HR_POLICY_STATUS_ENUM = exports.ALL_HR_DOCUMENT_STATUS_NAMES = exports.HR_DOCUMENT_STATUS_ENUM = exports.ALL_HR_DOCUMENT_TYPE_NAMES = exports.HR_DOCUMENT_TYPE_ENUM = exports.ALL_HR_PAYMENT_METHOD_NAMES = exports.HR_PAYMENT_METHOD_ENUM = exports.ALL_HR_PAYROLL_STATUS_NAMES = exports.HR_PAYROLL_STATUS_ENUM = exports.ALL_HR_PAY_TYPE_NAMES = exports.HR_PAY_TYPE_ENUM = exports.ALL_HR_EMPLOYEE_DOCUMENT_TYPES = exports.HR_EMPLOYEE_DOCUMENT_TYPE_ENUM = exports.ALL_HR_SHIFT_STATUS_NAMES = exports.HR_SHIFT_STATUS_ENUM = exports.ALL_HR_SHIFT_TYPE_NAMES = exports.HR_SHIFT_TYPE_ENUM = exports.ALL_HR_BIOMETRIC_ENROLLMENT_TYPE_NAMES = exports.HR_BIOMETRIC_ENROLLMENT_TYPE_ENUM = exports.ALL_HR_CLOCK_TIME_TYPE_NAMES = exports.HR_CLOCK_TIME_TYPE_ENUM = exports.ALL_HR_CHECK_IN_METHOD_NAMES = exports.HR_CHECK_IN_METHOD_ENUM = exports.ALL_HR_ATTENDANCE_STATUS_NAMES = exports.HR_ATTENDANCE_STATUS_ENUM = exports.ALL_HR_EMPLOYMENT_STATUS_NAMES = exports.HR_EMPLOYMENT_STATUS_ENUM = void 0;
5
5
  var HR_EMPLOYMENT_STATUS_ENUM;
6
6
  (function (HR_EMPLOYMENT_STATUS_ENUM) {
7
7
  HR_EMPLOYMENT_STATUS_ENUM["ACTIVE"] = "ACTIVE";
@@ -27,6 +27,12 @@ var HR_CHECK_IN_METHOD_ENUM;
27
27
  HR_CHECK_IN_METHOD_ENUM["QR"] = "QR";
28
28
  })(HR_CHECK_IN_METHOD_ENUM || (exports.HR_CHECK_IN_METHOD_ENUM = HR_CHECK_IN_METHOD_ENUM = {}));
29
29
  exports.ALL_HR_CHECK_IN_METHOD_NAMES = Object.values(HR_CHECK_IN_METHOD_ENUM);
30
+ var HR_CLOCK_TIME_TYPE_ENUM;
31
+ (function (HR_CLOCK_TIME_TYPE_ENUM) {
32
+ HR_CLOCK_TIME_TYPE_ENUM["CHECK_IN"] = "CHECK_IN";
33
+ HR_CLOCK_TIME_TYPE_ENUM["CHECK_OUT"] = "CHECK_OUT";
34
+ })(HR_CLOCK_TIME_TYPE_ENUM || (exports.HR_CLOCK_TIME_TYPE_ENUM = HR_CLOCK_TIME_TYPE_ENUM = {}));
35
+ exports.ALL_HR_CLOCK_TIME_TYPE_NAMES = Object.values(HR_CLOCK_TIME_TYPE_ENUM);
30
36
  var HR_BIOMETRIC_ENROLLMENT_TYPE_ENUM;
31
37
  (function (HR_BIOMETRIC_ENROLLMENT_TYPE_ENUM) {
32
38
  HR_BIOMETRIC_ENROLLMENT_TYPE_ENUM["FINGERPRINT"] = "FINGERPRINT";
@@ -25,12 +25,22 @@ export declare const TenantHrAttendanceRecordSchema: Schema<any, import("mongoos
25
25
  start_time: number;
26
26
  end_time: number;
27
27
  }>;
28
- clock_in: NativeDate;
29
- clock_out: NativeDate;
30
- total_break_minutes: number;
31
- total_hours: number;
32
- check_in_method: import("../../constants").HR_CHECK_IN_METHOD_ENUM;
33
- check_out_method: import("../../constants").HR_CHECK_IN_METHOD_ENUM;
28
+ attendance_date: string;
29
+ clock_time: import("mongoose").Types.DocumentArray<{
30
+ type: import("../../constants").HR_CLOCK_TIME_TYPE_ENUM;
31
+ method: import("../../constants").HR_CHECK_IN_METHOD_ENUM;
32
+ time: number;
33
+ }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
34
+ type: import("../../constants").HR_CLOCK_TIME_TYPE_ENUM;
35
+ method: import("../../constants").HR_CHECK_IN_METHOD_ENUM;
36
+ time: number;
37
+ }> & {
38
+ type: import("../../constants").HR_CLOCK_TIME_TYPE_ENUM;
39
+ method: import("../../constants").HR_CHECK_IN_METHOD_ENUM;
40
+ time: number;
41
+ }>;
42
+ total_break_time: number;
43
+ total_worked_time: number;
34
44
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
35
45
  createdAt: NativeDate;
36
46
  updatedAt: NativeDate;
@@ -52,12 +62,22 @@ export declare const TenantHrAttendanceRecordSchema: Schema<any, import("mongoos
52
62
  start_time: number;
53
63
  end_time: number;
54
64
  }>;
55
- clock_in: NativeDate;
56
- clock_out: NativeDate;
57
- total_break_minutes: number;
58
- total_hours: number;
59
- check_in_method: import("../../constants").HR_CHECK_IN_METHOD_ENUM;
60
- check_out_method: import("../../constants").HR_CHECK_IN_METHOD_ENUM;
65
+ attendance_date: string;
66
+ clock_time: import("mongoose").Types.DocumentArray<{
67
+ type: import("../../constants").HR_CLOCK_TIME_TYPE_ENUM;
68
+ method: import("../../constants").HR_CHECK_IN_METHOD_ENUM;
69
+ time: number;
70
+ }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
71
+ type: import("../../constants").HR_CLOCK_TIME_TYPE_ENUM;
72
+ method: import("../../constants").HR_CHECK_IN_METHOD_ENUM;
73
+ time: number;
74
+ }> & {
75
+ type: import("../../constants").HR_CLOCK_TIME_TYPE_ENUM;
76
+ method: import("../../constants").HR_CHECK_IN_METHOD_ENUM;
77
+ time: number;
78
+ }>;
79
+ total_break_time: number;
80
+ total_worked_time: number;
61
81
  }>> & import("mongoose").FlatRecord<{
62
82
  createdAt: NativeDate;
63
83
  updatedAt: NativeDate;
@@ -79,12 +99,22 @@ export declare const TenantHrAttendanceRecordSchema: Schema<any, import("mongoos
79
99
  start_time: number;
80
100
  end_time: number;
81
101
  }>;
82
- clock_in: NativeDate;
83
- clock_out: NativeDate;
84
- total_break_minutes: number;
85
- total_hours: number;
86
- check_in_method: import("../../constants").HR_CHECK_IN_METHOD_ENUM;
87
- check_out_method: import("../../constants").HR_CHECK_IN_METHOD_ENUM;
102
+ attendance_date: string;
103
+ clock_time: import("mongoose").Types.DocumentArray<{
104
+ type: import("../../constants").HR_CLOCK_TIME_TYPE_ENUM;
105
+ method: import("../../constants").HR_CHECK_IN_METHOD_ENUM;
106
+ time: number;
107
+ }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
108
+ type: import("../../constants").HR_CLOCK_TIME_TYPE_ENUM;
109
+ method: import("../../constants").HR_CHECK_IN_METHOD_ENUM;
110
+ time: number;
111
+ }> & {
112
+ type: import("../../constants").HR_CLOCK_TIME_TYPE_ENUM;
113
+ method: import("../../constants").HR_CHECK_IN_METHOD_ENUM;
114
+ time: number;
115
+ }>;
116
+ total_break_time: number;
117
+ total_worked_time: number;
88
118
  }> & Required<{
89
119
  _id: import("mongoose").Types.ObjectId;
90
120
  }> & {
@@ -7,10 +7,31 @@ const hrBreakTimeSchema = new mongoose_1.Schema({
7
7
  start_time: {
8
8
  type: Number,
9
9
  required: true,
10
+ min: 0,
11
+ max: 86399,
10
12
  },
11
13
  end_time: {
12
14
  type: Number,
13
15
  default: null,
16
+ min: 0,
17
+ max: 86399,
18
+ },
19
+ }, { _id: false, minimize: false });
20
+ const hrClockTimeSchema = new mongoose_1.Schema({
21
+ type: {
22
+ type: String,
23
+ required: true,
24
+ enum: constants_1.ALL_HR_CLOCK_TIME_TYPE_NAMES,
25
+ },
26
+ time: {
27
+ type: Number,
28
+ required: true,
29
+ min: 0,
30
+ },
31
+ method: {
32
+ type: String,
33
+ enum: constants_1.ALL_HR_CHECK_IN_METHOD_NAMES,
34
+ default: null,
14
35
  },
15
36
  }, { _id: false, minimize: false });
16
37
  exports.TenantHrAttendanceRecordSchema = new mongoose_1.Schema({
@@ -31,23 +52,24 @@ exports.TenantHrAttendanceRecordSchema = new mongoose_1.Schema({
31
52
  immutable: true,
32
53
  ref: 'tenant_hr_employees',
33
54
  },
34
- clock_in: {
35
- type: Date,
36
- default: null,
55
+ attendance_date: {
56
+ type: String,
57
+ required: true,
58
+ match: /^\d{4}-\d{2}-\d{2}$/,
37
59
  },
38
- clock_out: {
39
- type: Date,
40
- default: null,
60
+ clock_time: {
61
+ type: [hrClockTimeSchema],
62
+ default: [],
41
63
  },
42
64
  break_time: {
43
65
  type: [hrBreakTimeSchema],
44
66
  default: [],
45
67
  },
46
- total_break_minutes: {
68
+ total_break_time: {
47
69
  type: Number,
48
70
  default: 0,
49
71
  },
50
- total_hours: {
72
+ total_worked_time: {
51
73
  type: Number,
52
74
  default: 0,
53
75
  },
@@ -57,16 +79,6 @@ exports.TenantHrAttendanceRecordSchema = new mongoose_1.Schema({
57
79
  enum: constants_1.ALL_HR_ATTENDANCE_STATUS_NAMES,
58
80
  default: constants_1.HR_ATTENDANCE_STATUS_ENUM.PRESENT,
59
81
  },
60
- check_in_method: {
61
- type: String,
62
- enum: constants_1.ALL_HR_CHECK_IN_METHOD_NAMES,
63
- default: null,
64
- },
65
- check_out_method: {
66
- type: String,
67
- enum: constants_1.ALL_HR_CHECK_IN_METHOD_NAMES,
68
- default: null,
69
- },
70
82
  notes: {
71
83
  type: String,
72
84
  default: null,
@@ -87,4 +99,6 @@ exports.TenantHrAttendanceRecordSchema = new mongoose_1.Schema({
87
99
  versionKey: false,
88
100
  minimize: false,
89
101
  });
102
+ exports.TenantHrAttendanceRecordSchema.index({ tenant_id: 1, employee_id: 1, attendance_date: 1 }, { unique: true });
103
+ exports.TenantHrAttendanceRecordSchema.index({ tenant_id: 1, attendance_date: 1 });
90
104
  exports.TENANT_HR_ATTENDANCE_RECORDS_COLLECTION_NAME = 'tenant_hr_attendance_records';
@@ -1,20 +1,23 @@
1
- import { HR_ATTENDANCE_STATUS_ENUM, HR_CHECK_IN_METHOD_ENUM } from '../../constants';
1
+ import { HR_ATTENDANCE_STATUS_ENUM, HR_CHECK_IN_METHOD_ENUM, HR_CLOCK_TIME_TYPE_ENUM } from '../../constants';
2
2
  export interface ITenantHrBreakTime {
3
3
  start_time: number;
4
4
  end_time?: number | null;
5
5
  }
6
+ export interface ITenantHrClockTime {
7
+ type: HR_CLOCK_TIME_TYPE_ENUM;
8
+ time: number;
9
+ method: HR_CHECK_IN_METHOD_ENUM | null;
10
+ }
6
11
  export interface ITenantHrAttendanceRecord {
7
12
  _id: string;
8
13
  tenant_id: string;
9
14
  employee_id: string;
10
- clock_in: Date | null;
11
- clock_out: Date | null;
15
+ attendance_date: string;
16
+ clock_time: ITenantHrClockTime[];
12
17
  break_time: ITenantHrBreakTime[];
13
- total_break_minutes: number;
14
- total_hours: number;
18
+ total_break_time: number;
19
+ total_worked_time: number;
15
20
  status: HR_ATTENDANCE_STATUS_ENUM;
16
- check_in_method: HR_CHECK_IN_METHOD_ENUM | null;
17
- check_out_method: HR_CHECK_IN_METHOD_ENUM | null;
18
21
  notes?: string | null;
19
22
  createdAt: Date;
20
23
  updatedAt: Date | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.4.20",
3
+ "version": "0.4.21",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "module": "esm/index.js",