@empleado-juan/commons 1.0.0
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/constants/index.d.ts +30 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +34 -0
- package/dist/enums/index.d.ts +75 -0
- package/dist/enums/index.d.ts.map +1 -0
- package/dist/enums/index.js +98 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/types/attendance.d.ts +39 -0
- package/dist/types/attendance.d.ts.map +1 -0
- package/dist/types/attendance.js +1 -0
- package/dist/types/employee.d.ts +83 -0
- package/dist/types/employee.d.ts.map +1 -0
- package/dist/types/employee.js +1 -0
- package/dist/types/events.d.ts +69 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/events.js +16 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +8 -0
- package/dist/types/license.d.ts +57 -0
- package/dist/types/license.d.ts.map +1 -0
- package/dist/types/license.js +1 -0
- package/package.json +22 -0
- package/src/constants/index.ts +39 -0
- package/src/enums/index.ts +98 -0
- package/src/index.ts +15 -0
- package/src/types/attendance.ts +42 -0
- package/src/types/employee.ts +86 -0
- package/src/types/events.ts +76 -0
- package/src/types/index.ts +9 -0
- package/src/types/license.ts +62 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Constants
|
|
3
|
+
* Used across frontend and backend services
|
|
4
|
+
*/
|
|
5
|
+
export declare const TIME_CONSTANTS: {
|
|
6
|
+
readonly SECOND: 1000;
|
|
7
|
+
readonly MINUTE: number;
|
|
8
|
+
readonly HOUR: number;
|
|
9
|
+
readonly DAY: number;
|
|
10
|
+
readonly WEEK: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const LICENSE_CONSTANTS: {
|
|
13
|
+
readonly CACHE_TTL: number;
|
|
14
|
+
readonly GRACE_PERIOD: number;
|
|
15
|
+
readonly MAX_GRACE_PERIOD: number;
|
|
16
|
+
readonly VALIDATION_TIMEOUT: number;
|
|
17
|
+
readonly HEARTBEAT_INTERVAL: number;
|
|
18
|
+
};
|
|
19
|
+
export declare const API_RESPONSE: {
|
|
20
|
+
readonly SUCCESS: "success";
|
|
21
|
+
readonly ERROR: "error";
|
|
22
|
+
readonly WARNING: "warning";
|
|
23
|
+
};
|
|
24
|
+
export declare const PAGINATION: {
|
|
25
|
+
readonly DEFAULT_PAGE: 1;
|
|
26
|
+
readonly DEFAULT_LIMIT: 20;
|
|
27
|
+
readonly MAX_LIMIT: 100;
|
|
28
|
+
};
|
|
29
|
+
export declare const GIT_CO_AUTHOR: "Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>";
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,eAAO,MAAM,cAAc;;;;;;CAMjB,CAAC;AAGX,eAAO,MAAM,iBAAiB;;;;;;CAMpB,CAAC;AAGX,eAAO,MAAM,YAAY;;;;CAIf,CAAC;AAGX,eAAO,MAAM,UAAU;;;;CAIb,CAAC;AAGX,eAAO,MAAM,aAAa,EAAG,2DAAoE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Constants
|
|
3
|
+
* Used across frontend and backend services
|
|
4
|
+
*/
|
|
5
|
+
// Time constants
|
|
6
|
+
export const TIME_CONSTANTS = {
|
|
7
|
+
SECOND: 1000,
|
|
8
|
+
MINUTE: 60 * 1000,
|
|
9
|
+
HOUR: 60 * 60 * 1000,
|
|
10
|
+
DAY: 24 * 60 * 60 * 1000,
|
|
11
|
+
WEEK: 7 * 24 * 60 * 60 * 1000,
|
|
12
|
+
};
|
|
13
|
+
// License constants
|
|
14
|
+
export const LICENSE_CONSTANTS = {
|
|
15
|
+
CACHE_TTL: 5 * 60 * 1000, // 5 minutes
|
|
16
|
+
GRACE_PERIOD: 24 * 60 * 60 * 1000, // 24 hours
|
|
17
|
+
MAX_GRACE_PERIOD: 48 * 60 * 60 * 1000, // 48 hours
|
|
18
|
+
VALIDATION_TIMEOUT: 10 * 1000, // 10 seconds
|
|
19
|
+
HEARTBEAT_INTERVAL: 5 * 60 * 1000, // 5 minutes
|
|
20
|
+
};
|
|
21
|
+
// API Response constants
|
|
22
|
+
export const API_RESPONSE = {
|
|
23
|
+
SUCCESS: 'success',
|
|
24
|
+
ERROR: 'error',
|
|
25
|
+
WARNING: 'warning',
|
|
26
|
+
};
|
|
27
|
+
// Pagination defaults
|
|
28
|
+
export const PAGINATION = {
|
|
29
|
+
DEFAULT_PAGE: 1,
|
|
30
|
+
DEFAULT_LIMIT: 20,
|
|
31
|
+
MAX_LIMIT: 100,
|
|
32
|
+
};
|
|
33
|
+
// Co-Author for git commits
|
|
34
|
+
export const GIT_CO_AUTHOR = 'Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Enums
|
|
3
|
+
* Used across frontend and backend services
|
|
4
|
+
*/
|
|
5
|
+
export declare enum AttendanceEventType {
|
|
6
|
+
CHECK_IN = "CHECK_IN",
|
|
7
|
+
CHECK_OUT = "CHECK_OUT",
|
|
8
|
+
BREAK_START = "BREAK_START",
|
|
9
|
+
BREAK_END = "BREAK_END"
|
|
10
|
+
}
|
|
11
|
+
export declare enum VerifyMode {
|
|
12
|
+
PASSWORD = "PASSWORD",
|
|
13
|
+
FINGERPRINT = "FINGERPRINT",
|
|
14
|
+
CARD = "CARD",
|
|
15
|
+
FACE = "FACE"
|
|
16
|
+
}
|
|
17
|
+
export declare enum EmployeeStatus {
|
|
18
|
+
ACTIVE = "ACTIVE",
|
|
19
|
+
INACTIVE = "INACTIVE",
|
|
20
|
+
SUSPENDED = "SUSPENDED"
|
|
21
|
+
}
|
|
22
|
+
export declare enum PaymentType {
|
|
23
|
+
MONTHLY = "MONTHLY",
|
|
24
|
+
BIWEEKLY = "BIWEEKLY",
|
|
25
|
+
WEEKLY = "WEEKLY",
|
|
26
|
+
HOURLY = "HOURLY"
|
|
27
|
+
}
|
|
28
|
+
export declare enum ContractType {
|
|
29
|
+
INDEFINIDO = "INDEFINIDO",
|
|
30
|
+
FIJO = "FIJO",
|
|
31
|
+
OBRA_LABOR = "OBRA_LABOR",
|
|
32
|
+
APRENDIZAJE = "APRENDIZAJE"
|
|
33
|
+
}
|
|
34
|
+
export declare enum PayrollFrequency {
|
|
35
|
+
WEEKLY = "WEEKLY",
|
|
36
|
+
BIWEEKLY = "BIWEEKLY",
|
|
37
|
+
MONTHLY = "MONTHLY"
|
|
38
|
+
}
|
|
39
|
+
export declare enum UserRole {
|
|
40
|
+
SUPER_ADMIN = "SUPER_ADMIN",
|
|
41
|
+
ADMIN = "ADMIN",
|
|
42
|
+
MANAGER = "MANAGER",
|
|
43
|
+
EMPLOYEE = "EMPLOYEE"
|
|
44
|
+
}
|
|
45
|
+
export declare enum InstallationStatus {
|
|
46
|
+
ACTIVE = "ACTIVE",
|
|
47
|
+
INACTIVE = "INACTIVE",
|
|
48
|
+
SUSPENDED = "SUSPENDED"
|
|
49
|
+
}
|
|
50
|
+
export declare enum LicenseValidationReason {
|
|
51
|
+
VALID = "VALID",
|
|
52
|
+
EXPIRED = "EXPIRED",
|
|
53
|
+
NO_LICENSE = "NO_LICENSE",
|
|
54
|
+
INSTALLATION_NOT_FOUND = "INSTALLATION_NOT_FOUND",
|
|
55
|
+
INSTALLATION_SUSPENDED = "INSTALLATION_SUSPENDED",
|
|
56
|
+
MAX_CLIENTS_EXCEEDED = "MAX_CLIENTS_EXCEEDED",
|
|
57
|
+
GRACE_PERIOD_EXPIRED = "GRACE_PERIOD_EXPIRED",
|
|
58
|
+
DEACTIVATED_REMOTELY = "DEACTIVATED_REMOTELY"
|
|
59
|
+
}
|
|
60
|
+
export declare enum ShiftType {
|
|
61
|
+
FIXED = "FIXED",
|
|
62
|
+
ROTATING = "ROTATING",
|
|
63
|
+
FLEXIBLE = "FLEXIBLE"
|
|
64
|
+
}
|
|
65
|
+
export declare enum DayType {
|
|
66
|
+
WORK = "WORK",
|
|
67
|
+
REST = "REST",
|
|
68
|
+
HOLIDAY = "HOLIDAY"
|
|
69
|
+
}
|
|
70
|
+
export declare enum MessageBrokerType {
|
|
71
|
+
RABBITMQ = "rabbitmq",
|
|
72
|
+
KAFKA = "kafka",
|
|
73
|
+
SQS = "sqs"
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/enums/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,oBAAY,mBAAmB;IAC7B,QAAQ,aAAa;IACrB,SAAS,cAAc;IACvB,WAAW,gBAAgB;IAC3B,SAAS,cAAc;CACxB;AAGD,oBAAY,UAAU;IACpB,QAAQ,aAAa;IACrB,WAAW,gBAAgB;IAC3B,IAAI,SAAS;IACb,IAAI,SAAS;CACd;AAGD,oBAAY,cAAc;IACxB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,SAAS,cAAc;CACxB;AAGD,oBAAY,WAAW;IACrB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAGD,oBAAY,YAAY;IACtB,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,WAAW,gBAAgB;CAC5B;AAGD,oBAAY,gBAAgB;IAC1B,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,OAAO,YAAY;CACpB;AAGD,oBAAY,QAAQ;IAClB,WAAW,gBAAgB;IAC3B,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,QAAQ,aAAa;CACtB;AAGD,oBAAY,kBAAkB;IAC5B,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,SAAS,cAAc;CACxB;AAGD,oBAAY,uBAAuB;IACjC,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,sBAAsB,2BAA2B;IACjD,sBAAsB,2BAA2B;IACjD,oBAAoB,yBAAyB;IAC7C,oBAAoB,yBAAyB;IAC7C,oBAAoB,yBAAyB;CAC9C;AAGD,oBAAY,SAAS;IACnB,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,QAAQ,aAAa;CACtB;AAGD,oBAAY,OAAO;IACjB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAGD,oBAAY,iBAAiB;IAC3B,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,GAAG,QAAQ;CACZ"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Enums
|
|
3
|
+
* Used across frontend and backend services
|
|
4
|
+
*/
|
|
5
|
+
// Attendance Event Types
|
|
6
|
+
export var AttendanceEventType;
|
|
7
|
+
(function (AttendanceEventType) {
|
|
8
|
+
AttendanceEventType["CHECK_IN"] = "CHECK_IN";
|
|
9
|
+
AttendanceEventType["CHECK_OUT"] = "CHECK_OUT";
|
|
10
|
+
AttendanceEventType["BREAK_START"] = "BREAK_START";
|
|
11
|
+
AttendanceEventType["BREAK_END"] = "BREAK_END";
|
|
12
|
+
})(AttendanceEventType || (AttendanceEventType = {}));
|
|
13
|
+
// Verification Modes (Biometric devices)
|
|
14
|
+
export var VerifyMode;
|
|
15
|
+
(function (VerifyMode) {
|
|
16
|
+
VerifyMode["PASSWORD"] = "PASSWORD";
|
|
17
|
+
VerifyMode["FINGERPRINT"] = "FINGERPRINT";
|
|
18
|
+
VerifyMode["CARD"] = "CARD";
|
|
19
|
+
VerifyMode["FACE"] = "FACE";
|
|
20
|
+
})(VerifyMode || (VerifyMode = {}));
|
|
21
|
+
// Employee Status
|
|
22
|
+
export var EmployeeStatus;
|
|
23
|
+
(function (EmployeeStatus) {
|
|
24
|
+
EmployeeStatus["ACTIVE"] = "ACTIVE";
|
|
25
|
+
EmployeeStatus["INACTIVE"] = "INACTIVE";
|
|
26
|
+
EmployeeStatus["SUSPENDED"] = "SUSPENDED";
|
|
27
|
+
})(EmployeeStatus || (EmployeeStatus = {}));
|
|
28
|
+
// Payment Types
|
|
29
|
+
export var PaymentType;
|
|
30
|
+
(function (PaymentType) {
|
|
31
|
+
PaymentType["MONTHLY"] = "MONTHLY";
|
|
32
|
+
PaymentType["BIWEEKLY"] = "BIWEEKLY";
|
|
33
|
+
PaymentType["WEEKLY"] = "WEEKLY";
|
|
34
|
+
PaymentType["HOURLY"] = "HOURLY";
|
|
35
|
+
})(PaymentType || (PaymentType = {}));
|
|
36
|
+
// Contract Types
|
|
37
|
+
export var ContractType;
|
|
38
|
+
(function (ContractType) {
|
|
39
|
+
ContractType["INDEFINIDO"] = "INDEFINIDO";
|
|
40
|
+
ContractType["FIJO"] = "FIJO";
|
|
41
|
+
ContractType["OBRA_LABOR"] = "OBRA_LABOR";
|
|
42
|
+
ContractType["APRENDIZAJE"] = "APRENDIZAJE";
|
|
43
|
+
})(ContractType || (ContractType = {}));
|
|
44
|
+
// Payroll Frequency
|
|
45
|
+
export var PayrollFrequency;
|
|
46
|
+
(function (PayrollFrequency) {
|
|
47
|
+
PayrollFrequency["WEEKLY"] = "WEEKLY";
|
|
48
|
+
PayrollFrequency["BIWEEKLY"] = "BIWEEKLY";
|
|
49
|
+
PayrollFrequency["MONTHLY"] = "MONTHLY";
|
|
50
|
+
})(PayrollFrequency || (PayrollFrequency = {}));
|
|
51
|
+
// User Roles
|
|
52
|
+
export var UserRole;
|
|
53
|
+
(function (UserRole) {
|
|
54
|
+
UserRole["SUPER_ADMIN"] = "SUPER_ADMIN";
|
|
55
|
+
UserRole["ADMIN"] = "ADMIN";
|
|
56
|
+
UserRole["MANAGER"] = "MANAGER";
|
|
57
|
+
UserRole["EMPLOYEE"] = "EMPLOYEE";
|
|
58
|
+
})(UserRole || (UserRole = {}));
|
|
59
|
+
// Installation Status
|
|
60
|
+
export var InstallationStatus;
|
|
61
|
+
(function (InstallationStatus) {
|
|
62
|
+
InstallationStatus["ACTIVE"] = "ACTIVE";
|
|
63
|
+
InstallationStatus["INACTIVE"] = "INACTIVE";
|
|
64
|
+
InstallationStatus["SUSPENDED"] = "SUSPENDED";
|
|
65
|
+
})(InstallationStatus || (InstallationStatus = {}));
|
|
66
|
+
// License Validation Reasons
|
|
67
|
+
export var LicenseValidationReason;
|
|
68
|
+
(function (LicenseValidationReason) {
|
|
69
|
+
LicenseValidationReason["VALID"] = "VALID";
|
|
70
|
+
LicenseValidationReason["EXPIRED"] = "EXPIRED";
|
|
71
|
+
LicenseValidationReason["NO_LICENSE"] = "NO_LICENSE";
|
|
72
|
+
LicenseValidationReason["INSTALLATION_NOT_FOUND"] = "INSTALLATION_NOT_FOUND";
|
|
73
|
+
LicenseValidationReason["INSTALLATION_SUSPENDED"] = "INSTALLATION_SUSPENDED";
|
|
74
|
+
LicenseValidationReason["MAX_CLIENTS_EXCEEDED"] = "MAX_CLIENTS_EXCEEDED";
|
|
75
|
+
LicenseValidationReason["GRACE_PERIOD_EXPIRED"] = "GRACE_PERIOD_EXPIRED";
|
|
76
|
+
LicenseValidationReason["DEACTIVATED_REMOTELY"] = "DEACTIVATED_REMOTELY";
|
|
77
|
+
})(LicenseValidationReason || (LicenseValidationReason = {}));
|
|
78
|
+
// Shift Types
|
|
79
|
+
export var ShiftType;
|
|
80
|
+
(function (ShiftType) {
|
|
81
|
+
ShiftType["FIXED"] = "FIXED";
|
|
82
|
+
ShiftType["ROTATING"] = "ROTATING";
|
|
83
|
+
ShiftType["FLEXIBLE"] = "FLEXIBLE";
|
|
84
|
+
})(ShiftType || (ShiftType = {}));
|
|
85
|
+
// Day Types
|
|
86
|
+
export var DayType;
|
|
87
|
+
(function (DayType) {
|
|
88
|
+
DayType["WORK"] = "WORK";
|
|
89
|
+
DayType["REST"] = "REST";
|
|
90
|
+
DayType["HOLIDAY"] = "HOLIDAY";
|
|
91
|
+
})(DayType || (DayType = {}));
|
|
92
|
+
// Message Broker Types
|
|
93
|
+
export var MessageBrokerType;
|
|
94
|
+
(function (MessageBrokerType) {
|
|
95
|
+
MessageBrokerType["RABBITMQ"] = "rabbitmq";
|
|
96
|
+
MessageBrokerType["KAFKA"] = "kafka";
|
|
97
|
+
MessageBrokerType["SQS"] = "sqs";
|
|
98
|
+
})(MessageBrokerType || (MessageBrokerType = {}));
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @empleado-juan/commons
|
|
3
|
+
*
|
|
4
|
+
* Shared code between frontend and backend services
|
|
5
|
+
* Including types, enums, constants, and validators
|
|
6
|
+
*/
|
|
7
|
+
export * from './enums/index.js';
|
|
8
|
+
export * from './types/index.js';
|
|
9
|
+
export * from './constants/index.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,kBAAkB,CAAC;AAGjC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,sBAAsB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @empleado-juan/commons
|
|
3
|
+
*
|
|
4
|
+
* Shared code between frontend and backend services
|
|
5
|
+
* Including types, enums, constants, and validators
|
|
6
|
+
*/
|
|
7
|
+
// Export all enums
|
|
8
|
+
export * from './enums/index.js';
|
|
9
|
+
// Export all types
|
|
10
|
+
export * from './types/index.js';
|
|
11
|
+
// Export all constants
|
|
12
|
+
export * from './constants/index.js';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AttendanceEventType, VerifyMode } from '../enums/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Attendance Record Types
|
|
4
|
+
*/
|
|
5
|
+
export interface AttendanceRecord {
|
|
6
|
+
id: string;
|
|
7
|
+
employeeId: string;
|
|
8
|
+
branchId: string;
|
|
9
|
+
deviceId?: string;
|
|
10
|
+
timestamp: Date;
|
|
11
|
+
eventType: AttendanceEventType;
|
|
12
|
+
verifyMode?: VerifyMode;
|
|
13
|
+
isManual: boolean;
|
|
14
|
+
notes?: string;
|
|
15
|
+
hikvisionEventId?: string;
|
|
16
|
+
rawData?: any;
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
updatedAt: Date;
|
|
19
|
+
}
|
|
20
|
+
export interface CreateAttendanceInput {
|
|
21
|
+
employeeId: string;
|
|
22
|
+
branchId: string;
|
|
23
|
+
deviceId?: string;
|
|
24
|
+
timestamp: Date;
|
|
25
|
+
eventType: AttendanceEventType;
|
|
26
|
+
verifyMode?: VerifyMode;
|
|
27
|
+
isManual?: boolean;
|
|
28
|
+
notes?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface AttendanceEvent {
|
|
31
|
+
id: string;
|
|
32
|
+
employeeId: string;
|
|
33
|
+
timestamp: Date;
|
|
34
|
+
eventType: AttendanceEventType;
|
|
35
|
+
branchId: string;
|
|
36
|
+
deviceId?: string;
|
|
37
|
+
verifyMode?: VerifyMode;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=attendance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attendance.d.ts","sourceRoot":"","sources":["../../src/types/attendance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpE;;GAEG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,mBAAmB,CAAC;IAC/B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,mBAAmB,CAAC;IAC/B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,mBAAmB,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { PaymentType } from '../enums/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Employee Types
|
|
4
|
+
*/
|
|
5
|
+
export interface Employee {
|
|
6
|
+
id: string;
|
|
7
|
+
branchId: string;
|
|
8
|
+
employeeNumber: string;
|
|
9
|
+
firstName: string;
|
|
10
|
+
lastName: string;
|
|
11
|
+
email?: string;
|
|
12
|
+
phone?: string;
|
|
13
|
+
address?: string;
|
|
14
|
+
positionId?: string;
|
|
15
|
+
departmentId?: string;
|
|
16
|
+
supervisorId?: string;
|
|
17
|
+
hireDate: Date;
|
|
18
|
+
terminationDate?: Date;
|
|
19
|
+
baseSalary?: number;
|
|
20
|
+
hourlyRate?: number;
|
|
21
|
+
paymentType: PaymentType;
|
|
22
|
+
bankAccount?: string;
|
|
23
|
+
hikvisionUserId?: string;
|
|
24
|
+
cardNumber?: string;
|
|
25
|
+
photo?: string;
|
|
26
|
+
isActive: boolean;
|
|
27
|
+
requiresAttendance: boolean;
|
|
28
|
+
isSuspended: boolean;
|
|
29
|
+
suspendedAt?: Date;
|
|
30
|
+
suspendedUntil?: Date;
|
|
31
|
+
suspensionReason?: string;
|
|
32
|
+
deactivatedAt?: Date;
|
|
33
|
+
deactivationReason?: string;
|
|
34
|
+
userId?: string;
|
|
35
|
+
createdAt: Date;
|
|
36
|
+
updatedAt: Date;
|
|
37
|
+
}
|
|
38
|
+
export interface CreateEmployeeInput {
|
|
39
|
+
branchId: string;
|
|
40
|
+
employeeNumber: string;
|
|
41
|
+
firstName: string;
|
|
42
|
+
lastName: string;
|
|
43
|
+
email?: string;
|
|
44
|
+
phone?: string;
|
|
45
|
+
address?: string;
|
|
46
|
+
positionId?: string;
|
|
47
|
+
departmentId?: string;
|
|
48
|
+
supervisorId?: string;
|
|
49
|
+
hireDate: Date;
|
|
50
|
+
baseSalary?: number;
|
|
51
|
+
hourlyRate?: number;
|
|
52
|
+
paymentType?: PaymentType;
|
|
53
|
+
bankAccount?: string;
|
|
54
|
+
hikvisionUserId?: string;
|
|
55
|
+
cardNumber?: string;
|
|
56
|
+
photo?: string;
|
|
57
|
+
scheduleId?: string;
|
|
58
|
+
scheduleStartDate?: Date;
|
|
59
|
+
createUserAccount?: boolean;
|
|
60
|
+
userPassword?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface UpdateEmployeeInput {
|
|
63
|
+
firstName?: string;
|
|
64
|
+
lastName?: string;
|
|
65
|
+
email?: string;
|
|
66
|
+
phone?: string;
|
|
67
|
+
address?: string;
|
|
68
|
+
positionId?: string;
|
|
69
|
+
departmentId?: string;
|
|
70
|
+
supervisorId?: string;
|
|
71
|
+
baseSalary?: number;
|
|
72
|
+
hourlyRate?: number;
|
|
73
|
+
paymentType?: PaymentType;
|
|
74
|
+
bankAccount?: string;
|
|
75
|
+
scheduleId?: string;
|
|
76
|
+
scheduleStartDate?: Date;
|
|
77
|
+
photo?: string;
|
|
78
|
+
isActive?: boolean;
|
|
79
|
+
isSuspended?: boolean;
|
|
80
|
+
suspendedUntil?: Date;
|
|
81
|
+
suspensionReason?: string;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=employee.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"employee.d.ts","sourceRoot":"","sources":["../../src/types/employee.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event System Types
|
|
3
|
+
* Used for message broker events
|
|
4
|
+
*/
|
|
5
|
+
export interface EventMessage {
|
|
6
|
+
key?: string;
|
|
7
|
+
value: string | object;
|
|
8
|
+
headers?: Record<string, string>;
|
|
9
|
+
}
|
|
10
|
+
export interface AttendanceCreatedEvent {
|
|
11
|
+
id: string;
|
|
12
|
+
clientId: string;
|
|
13
|
+
employeeId: string;
|
|
14
|
+
timestamp: string;
|
|
15
|
+
eventType: string;
|
|
16
|
+
branchId: string;
|
|
17
|
+
deviceId?: string;
|
|
18
|
+
verifyMode?: string;
|
|
19
|
+
data: any;
|
|
20
|
+
}
|
|
21
|
+
export interface EmployeeCreatedEvent {
|
|
22
|
+
id: string;
|
|
23
|
+
clientId: string;
|
|
24
|
+
employeeNumber: string;
|
|
25
|
+
firstName: string;
|
|
26
|
+
lastName: string;
|
|
27
|
+
email?: string;
|
|
28
|
+
branchId: string;
|
|
29
|
+
isActive: boolean;
|
|
30
|
+
data: any;
|
|
31
|
+
}
|
|
32
|
+
export interface CompensationCreatedEvent {
|
|
33
|
+
id: string;
|
|
34
|
+
employeeId: string;
|
|
35
|
+
validFrom: string;
|
|
36
|
+
validTo?: string;
|
|
37
|
+
baseSalaryMonthlyCents: number;
|
|
38
|
+
hourlyRateCents: number;
|
|
39
|
+
contractType: string;
|
|
40
|
+
paymentFrequency: string;
|
|
41
|
+
scheduledHoursPerWeek: number;
|
|
42
|
+
legalTemplateVersionId: string;
|
|
43
|
+
changeReason?: string;
|
|
44
|
+
authorizedBy?: string;
|
|
45
|
+
data: any;
|
|
46
|
+
}
|
|
47
|
+
export interface ScheduleCreatedEvent {
|
|
48
|
+
id: string;
|
|
49
|
+
employeeId: string;
|
|
50
|
+
shiftTemplateId: string;
|
|
51
|
+
startDate: string;
|
|
52
|
+
endDate?: string;
|
|
53
|
+
rotationStartDate?: string;
|
|
54
|
+
isActive: boolean;
|
|
55
|
+
data: any;
|
|
56
|
+
}
|
|
57
|
+
export declare const EVENT_TOPICS: {
|
|
58
|
+
readonly ATTENDANCE_CREATED: "attendance-created";
|
|
59
|
+
readonly ATTENDANCE_UPDATED: "attendance-updated";
|
|
60
|
+
readonly EMPLOYEE_CREATED: "employee-created";
|
|
61
|
+
readonly EMPLOYEE_UPDATED: "employee-updated";
|
|
62
|
+
readonly EMPLOYEE_DELETED: "employee-deleted";
|
|
63
|
+
readonly COMPENSATION_CREATED: "compensation-created";
|
|
64
|
+
readonly COMPENSATION_UPDATED: "compensation-updated";
|
|
65
|
+
readonly SCHEDULE_CREATED: "schedule-created";
|
|
66
|
+
readonly SCHEDULE_UPDATED: "schedule-updated";
|
|
67
|
+
};
|
|
68
|
+
export type EventTopic = typeof EVENT_TOPICS[keyof typeof EVENT_TOPICS];
|
|
69
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,GAAG,CAAC;CACX;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,GAAG,CAAC;CACX;AAED,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,GAAG,CAAC;CACX;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,GAAG,CAAC;CACX;AAGD,eAAO,MAAM,YAAY;;;;;;;;;;CAUf,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,OAAO,YAAY,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event System Types
|
|
3
|
+
* Used for message broker events
|
|
4
|
+
*/
|
|
5
|
+
// Event topic names
|
|
6
|
+
export const EVENT_TOPICS = {
|
|
7
|
+
ATTENDANCE_CREATED: 'attendance-created',
|
|
8
|
+
ATTENDANCE_UPDATED: 'attendance-updated',
|
|
9
|
+
EMPLOYEE_CREATED: 'employee-created',
|
|
10
|
+
EMPLOYEE_UPDATED: 'employee-updated',
|
|
11
|
+
EMPLOYEE_DELETED: 'employee-deleted',
|
|
12
|
+
COMPENSATION_CREATED: 'compensation-created',
|
|
13
|
+
COMPENSATION_UPDATED: 'compensation-updated',
|
|
14
|
+
SCHEDULE_CREATED: 'schedule-created',
|
|
15
|
+
SCHEDULE_UPDATED: 'schedule-updated',
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { InstallationStatus, LicenseValidationReason } from '../enums/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* License System Types
|
|
4
|
+
*/
|
|
5
|
+
export interface LicenseStatus {
|
|
6
|
+
valid: boolean;
|
|
7
|
+
expiresAt?: Date;
|
|
8
|
+
maxClients?: number;
|
|
9
|
+
features?: Record<string, any>;
|
|
10
|
+
reason?: LicenseValidationReason | string;
|
|
11
|
+
warning?: string;
|
|
12
|
+
graceTimeRemaining?: number;
|
|
13
|
+
hoursOffline?: number;
|
|
14
|
+
companyName?: string;
|
|
15
|
+
installationStatus?: InstallationStatus;
|
|
16
|
+
}
|
|
17
|
+
export interface License {
|
|
18
|
+
id: string;
|
|
19
|
+
installationId: string;
|
|
20
|
+
licenseKey: string;
|
|
21
|
+
expiresAt: Date;
|
|
22
|
+
maxClients?: number;
|
|
23
|
+
features?: Record<string, any>;
|
|
24
|
+
isActive: boolean;
|
|
25
|
+
generatedById: string;
|
|
26
|
+
createdAt: Date;
|
|
27
|
+
updatedAt: Date;
|
|
28
|
+
}
|
|
29
|
+
export interface Installation {
|
|
30
|
+
id: string;
|
|
31
|
+
installationId: string;
|
|
32
|
+
companyName: string;
|
|
33
|
+
contactEmail?: string;
|
|
34
|
+
contactName?: string;
|
|
35
|
+
contactPhone?: string;
|
|
36
|
+
status: InstallationStatus;
|
|
37
|
+
isOnline: boolean;
|
|
38
|
+
lastSeenAt?: Date;
|
|
39
|
+
employeeCount?: number;
|
|
40
|
+
clientCount?: number;
|
|
41
|
+
version?: string;
|
|
42
|
+
notes?: string;
|
|
43
|
+
createdById: string;
|
|
44
|
+
createdAt: Date;
|
|
45
|
+
updatedAt: Date;
|
|
46
|
+
}
|
|
47
|
+
export interface HeartbeatMetrics {
|
|
48
|
+
employeeCount: number;
|
|
49
|
+
clientCount: number;
|
|
50
|
+
version: string;
|
|
51
|
+
}
|
|
52
|
+
export interface LicenseCache {
|
|
53
|
+
status: LicenseStatus;
|
|
54
|
+
timestamp: number;
|
|
55
|
+
lastSuccessfulValidation: number;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=license.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"license.d.ts","sourceRoot":"","sources":["../../src/types/license.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEhF;;GAEG;AAEH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,uBAAuB,GAAG,MAAM,CAAC;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,IAAI,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,wBAAwB,EAAE,MAAM,CAAC;CAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@empleado-juan/commons",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Shared code between frontend and backend services",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"dev": "tsc --watch",
|
|
11
|
+
"clean": "rm -rf dist"
|
|
12
|
+
},
|
|
13
|
+
"keywords": ["shared", "types", "enums", "validators"],
|
|
14
|
+
"author": "Empleado Juan Team",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"zod": "^3.24.1"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"typescript": "^5.7.2"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Constants
|
|
3
|
+
* Used across frontend and backend services
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Time constants
|
|
7
|
+
export const TIME_CONSTANTS = {
|
|
8
|
+
SECOND: 1000,
|
|
9
|
+
MINUTE: 60 * 1000,
|
|
10
|
+
HOUR: 60 * 60 * 1000,
|
|
11
|
+
DAY: 24 * 60 * 60 * 1000,
|
|
12
|
+
WEEK: 7 * 24 * 60 * 60 * 1000,
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
// License constants
|
|
16
|
+
export const LICENSE_CONSTANTS = {
|
|
17
|
+
CACHE_TTL: 5 * 60 * 1000, // 5 minutes
|
|
18
|
+
GRACE_PERIOD: 24 * 60 * 60 * 1000, // 24 hours
|
|
19
|
+
MAX_GRACE_PERIOD: 48 * 60 * 60 * 1000, // 48 hours
|
|
20
|
+
VALIDATION_TIMEOUT: 10 * 1000, // 10 seconds
|
|
21
|
+
HEARTBEAT_INTERVAL: 5 * 60 * 1000, // 5 minutes
|
|
22
|
+
} as const;
|
|
23
|
+
|
|
24
|
+
// API Response constants
|
|
25
|
+
export const API_RESPONSE = {
|
|
26
|
+
SUCCESS: 'success',
|
|
27
|
+
ERROR: 'error',
|
|
28
|
+
WARNING: 'warning',
|
|
29
|
+
} as const;
|
|
30
|
+
|
|
31
|
+
// Pagination defaults
|
|
32
|
+
export const PAGINATION = {
|
|
33
|
+
DEFAULT_PAGE: 1,
|
|
34
|
+
DEFAULT_LIMIT: 20,
|
|
35
|
+
MAX_LIMIT: 100,
|
|
36
|
+
} as const;
|
|
37
|
+
|
|
38
|
+
// Co-Author for git commits
|
|
39
|
+
export const GIT_CO_AUTHOR = 'Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>' as const;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Enums
|
|
3
|
+
* Used across frontend and backend services
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Attendance Event Types
|
|
7
|
+
export enum AttendanceEventType {
|
|
8
|
+
CHECK_IN = 'CHECK_IN',
|
|
9
|
+
CHECK_OUT = 'CHECK_OUT',
|
|
10
|
+
BREAK_START = 'BREAK_START',
|
|
11
|
+
BREAK_END = 'BREAK_END',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Verification Modes (Biometric devices)
|
|
15
|
+
export enum VerifyMode {
|
|
16
|
+
PASSWORD = 'PASSWORD',
|
|
17
|
+
FINGERPRINT = 'FINGERPRINT',
|
|
18
|
+
CARD = 'CARD',
|
|
19
|
+
FACE = 'FACE',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Employee Status
|
|
23
|
+
export enum EmployeeStatus {
|
|
24
|
+
ACTIVE = 'ACTIVE',
|
|
25
|
+
INACTIVE = 'INACTIVE',
|
|
26
|
+
SUSPENDED = 'SUSPENDED',
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Payment Types
|
|
30
|
+
export enum PaymentType {
|
|
31
|
+
MONTHLY = 'MONTHLY',
|
|
32
|
+
BIWEEKLY = 'BIWEEKLY',
|
|
33
|
+
WEEKLY = 'WEEKLY',
|
|
34
|
+
HOURLY = 'HOURLY',
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Contract Types
|
|
38
|
+
export enum ContractType {
|
|
39
|
+
INDEFINIDO = 'INDEFINIDO',
|
|
40
|
+
FIJO = 'FIJO',
|
|
41
|
+
OBRA_LABOR = 'OBRA_LABOR',
|
|
42
|
+
APRENDIZAJE = 'APRENDIZAJE',
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Payroll Frequency
|
|
46
|
+
export enum PayrollFrequency {
|
|
47
|
+
WEEKLY = 'WEEKLY',
|
|
48
|
+
BIWEEKLY = 'BIWEEKLY',
|
|
49
|
+
MONTHLY = 'MONTHLY',
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// User Roles
|
|
53
|
+
export enum UserRole {
|
|
54
|
+
SUPER_ADMIN = 'SUPER_ADMIN',
|
|
55
|
+
ADMIN = 'ADMIN',
|
|
56
|
+
MANAGER = 'MANAGER',
|
|
57
|
+
EMPLOYEE = 'EMPLOYEE',
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Installation Status
|
|
61
|
+
export enum InstallationStatus {
|
|
62
|
+
ACTIVE = 'ACTIVE',
|
|
63
|
+
INACTIVE = 'INACTIVE',
|
|
64
|
+
SUSPENDED = 'SUSPENDED',
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// License Validation Reasons
|
|
68
|
+
export enum LicenseValidationReason {
|
|
69
|
+
VALID = 'VALID',
|
|
70
|
+
EXPIRED = 'EXPIRED',
|
|
71
|
+
NO_LICENSE = 'NO_LICENSE',
|
|
72
|
+
INSTALLATION_NOT_FOUND = 'INSTALLATION_NOT_FOUND',
|
|
73
|
+
INSTALLATION_SUSPENDED = 'INSTALLATION_SUSPENDED',
|
|
74
|
+
MAX_CLIENTS_EXCEEDED = 'MAX_CLIENTS_EXCEEDED',
|
|
75
|
+
GRACE_PERIOD_EXPIRED = 'GRACE_PERIOD_EXPIRED',
|
|
76
|
+
DEACTIVATED_REMOTELY = 'DEACTIVATED_REMOTELY',
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Shift Types
|
|
80
|
+
export enum ShiftType {
|
|
81
|
+
FIXED = 'FIXED',
|
|
82
|
+
ROTATING = 'ROTATING',
|
|
83
|
+
FLEXIBLE = 'FLEXIBLE',
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Day Types
|
|
87
|
+
export enum DayType {
|
|
88
|
+
WORK = 'WORK',
|
|
89
|
+
REST = 'REST',
|
|
90
|
+
HOLIDAY = 'HOLIDAY',
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Message Broker Types
|
|
94
|
+
export enum MessageBrokerType {
|
|
95
|
+
RABBITMQ = 'rabbitmq',
|
|
96
|
+
KAFKA = 'kafka',
|
|
97
|
+
SQS = 'sqs',
|
|
98
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @empleado-juan/commons
|
|
3
|
+
*
|
|
4
|
+
* Shared code between frontend and backend services
|
|
5
|
+
* Including types, enums, constants, and validators
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// Export all enums
|
|
9
|
+
export * from './enums/index.js';
|
|
10
|
+
|
|
11
|
+
// Export all types
|
|
12
|
+
export * from './types/index.js';
|
|
13
|
+
|
|
14
|
+
// Export all constants
|
|
15
|
+
export * from './constants/index.js';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { AttendanceEventType, VerifyMode } from '../enums/index.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Attendance Record Types
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface AttendanceRecord {
|
|
8
|
+
id: string;
|
|
9
|
+
employeeId: string;
|
|
10
|
+
branchId: string;
|
|
11
|
+
deviceId?: string;
|
|
12
|
+
timestamp: Date;
|
|
13
|
+
eventType: AttendanceEventType;
|
|
14
|
+
verifyMode?: VerifyMode;
|
|
15
|
+
isManual: boolean;
|
|
16
|
+
notes?: string;
|
|
17
|
+
hikvisionEventId?: string;
|
|
18
|
+
rawData?: any;
|
|
19
|
+
createdAt: Date;
|
|
20
|
+
updatedAt: Date;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface CreateAttendanceInput {
|
|
24
|
+
employeeId: string;
|
|
25
|
+
branchId: string;
|
|
26
|
+
deviceId?: string;
|
|
27
|
+
timestamp: Date;
|
|
28
|
+
eventType: AttendanceEventType;
|
|
29
|
+
verifyMode?: VerifyMode;
|
|
30
|
+
isManual?: boolean;
|
|
31
|
+
notes?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface AttendanceEvent {
|
|
35
|
+
id: string;
|
|
36
|
+
employeeId: string;
|
|
37
|
+
timestamp: Date;
|
|
38
|
+
eventType: AttendanceEventType;
|
|
39
|
+
branchId: string;
|
|
40
|
+
deviceId?: string;
|
|
41
|
+
verifyMode?: VerifyMode;
|
|
42
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { EmployeeStatus, PaymentType } from '../enums/index.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Employee Types
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface Employee {
|
|
8
|
+
id: string;
|
|
9
|
+
branchId: string;
|
|
10
|
+
employeeNumber: string;
|
|
11
|
+
firstName: string;
|
|
12
|
+
lastName: string;
|
|
13
|
+
email?: string;
|
|
14
|
+
phone?: string;
|
|
15
|
+
address?: string;
|
|
16
|
+
positionId?: string;
|
|
17
|
+
departmentId?: string;
|
|
18
|
+
supervisorId?: string;
|
|
19
|
+
hireDate: Date;
|
|
20
|
+
terminationDate?: Date;
|
|
21
|
+
baseSalary?: number;
|
|
22
|
+
hourlyRate?: number;
|
|
23
|
+
paymentType: PaymentType;
|
|
24
|
+
bankAccount?: string;
|
|
25
|
+
hikvisionUserId?: string;
|
|
26
|
+
cardNumber?: string;
|
|
27
|
+
photo?: string;
|
|
28
|
+
isActive: boolean;
|
|
29
|
+
requiresAttendance: boolean;
|
|
30
|
+
isSuspended: boolean;
|
|
31
|
+
suspendedAt?: Date;
|
|
32
|
+
suspendedUntil?: Date;
|
|
33
|
+
suspensionReason?: string;
|
|
34
|
+
deactivatedAt?: Date;
|
|
35
|
+
deactivationReason?: string;
|
|
36
|
+
userId?: string;
|
|
37
|
+
createdAt: Date;
|
|
38
|
+
updatedAt: Date;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface CreateEmployeeInput {
|
|
42
|
+
branchId: string;
|
|
43
|
+
employeeNumber: string;
|
|
44
|
+
firstName: string;
|
|
45
|
+
lastName: string;
|
|
46
|
+
email?: string;
|
|
47
|
+
phone?: string;
|
|
48
|
+
address?: string;
|
|
49
|
+
positionId?: string;
|
|
50
|
+
departmentId?: string;
|
|
51
|
+
supervisorId?: string;
|
|
52
|
+
hireDate: Date;
|
|
53
|
+
baseSalary?: number;
|
|
54
|
+
hourlyRate?: number;
|
|
55
|
+
paymentType?: PaymentType;
|
|
56
|
+
bankAccount?: string;
|
|
57
|
+
hikvisionUserId?: string;
|
|
58
|
+
cardNumber?: string;
|
|
59
|
+
photo?: string;
|
|
60
|
+
scheduleId?: string;
|
|
61
|
+
scheduleStartDate?: Date;
|
|
62
|
+
createUserAccount?: boolean;
|
|
63
|
+
userPassword?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface UpdateEmployeeInput {
|
|
67
|
+
firstName?: string;
|
|
68
|
+
lastName?: string;
|
|
69
|
+
email?: string;
|
|
70
|
+
phone?: string;
|
|
71
|
+
address?: string;
|
|
72
|
+
positionId?: string;
|
|
73
|
+
departmentId?: string;
|
|
74
|
+
supervisorId?: string;
|
|
75
|
+
baseSalary?: number;
|
|
76
|
+
hourlyRate?: number;
|
|
77
|
+
paymentType?: PaymentType;
|
|
78
|
+
bankAccount?: string;
|
|
79
|
+
scheduleId?: string;
|
|
80
|
+
scheduleStartDate?: Date;
|
|
81
|
+
photo?: string;
|
|
82
|
+
isActive?: boolean;
|
|
83
|
+
isSuspended?: boolean;
|
|
84
|
+
suspendedUntil?: Date;
|
|
85
|
+
suspensionReason?: string;
|
|
86
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event System Types
|
|
3
|
+
* Used for message broker events
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface EventMessage {
|
|
7
|
+
key?: string;
|
|
8
|
+
value: string | object;
|
|
9
|
+
headers?: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface AttendanceCreatedEvent {
|
|
13
|
+
id: string;
|
|
14
|
+
clientId: string;
|
|
15
|
+
employeeId: string;
|
|
16
|
+
timestamp: string;
|
|
17
|
+
eventType: string;
|
|
18
|
+
branchId: string;
|
|
19
|
+
deviceId?: string;
|
|
20
|
+
verifyMode?: string;
|
|
21
|
+
data: any;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface EmployeeCreatedEvent {
|
|
25
|
+
id: string;
|
|
26
|
+
clientId: string;
|
|
27
|
+
employeeNumber: string;
|
|
28
|
+
firstName: string;
|
|
29
|
+
lastName: string;
|
|
30
|
+
email?: string;
|
|
31
|
+
branchId: string;
|
|
32
|
+
isActive: boolean;
|
|
33
|
+
data: any;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface CompensationCreatedEvent {
|
|
37
|
+
id: string;
|
|
38
|
+
employeeId: string;
|
|
39
|
+
validFrom: string;
|
|
40
|
+
validTo?: string;
|
|
41
|
+
baseSalaryMonthlyCents: number;
|
|
42
|
+
hourlyRateCents: number;
|
|
43
|
+
contractType: string;
|
|
44
|
+
paymentFrequency: string;
|
|
45
|
+
scheduledHoursPerWeek: number;
|
|
46
|
+
legalTemplateVersionId: string;
|
|
47
|
+
changeReason?: string;
|
|
48
|
+
authorizedBy?: string;
|
|
49
|
+
data: any;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface ScheduleCreatedEvent {
|
|
53
|
+
id: string;
|
|
54
|
+
employeeId: string;
|
|
55
|
+
shiftTemplateId: string;
|
|
56
|
+
startDate: string;
|
|
57
|
+
endDate?: string;
|
|
58
|
+
rotationStartDate?: string;
|
|
59
|
+
isActive: boolean;
|
|
60
|
+
data: any;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Event topic names
|
|
64
|
+
export const EVENT_TOPICS = {
|
|
65
|
+
ATTENDANCE_CREATED: 'attendance-created',
|
|
66
|
+
ATTENDANCE_UPDATED: 'attendance-updated',
|
|
67
|
+
EMPLOYEE_CREATED: 'employee-created',
|
|
68
|
+
EMPLOYEE_UPDATED: 'employee-updated',
|
|
69
|
+
EMPLOYEE_DELETED: 'employee-deleted',
|
|
70
|
+
COMPENSATION_CREATED: 'compensation-created',
|
|
71
|
+
COMPENSATION_UPDATED: 'compensation-updated',
|
|
72
|
+
SCHEDULE_CREATED: 'schedule-created',
|
|
73
|
+
SCHEDULE_UPDATED: 'schedule-updated',
|
|
74
|
+
} as const;
|
|
75
|
+
|
|
76
|
+
export type EventTopic = typeof EVENT_TOPICS[keyof typeof EVENT_TOPICS];
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { InstallationStatus, LicenseValidationReason } from '../enums/index.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* License System Types
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface LicenseStatus {
|
|
8
|
+
valid: boolean;
|
|
9
|
+
expiresAt?: Date;
|
|
10
|
+
maxClients?: number;
|
|
11
|
+
features?: Record<string, any>;
|
|
12
|
+
reason?: LicenseValidationReason | string;
|
|
13
|
+
warning?: string;
|
|
14
|
+
graceTimeRemaining?: number;
|
|
15
|
+
hoursOffline?: number;
|
|
16
|
+
companyName?: string;
|
|
17
|
+
installationStatus?: InstallationStatus;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface License {
|
|
21
|
+
id: string;
|
|
22
|
+
installationId: string;
|
|
23
|
+
licenseKey: string;
|
|
24
|
+
expiresAt: Date;
|
|
25
|
+
maxClients?: number;
|
|
26
|
+
features?: Record<string, any>;
|
|
27
|
+
isActive: boolean;
|
|
28
|
+
generatedById: string;
|
|
29
|
+
createdAt: Date;
|
|
30
|
+
updatedAt: Date;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface Installation {
|
|
34
|
+
id: string;
|
|
35
|
+
installationId: string;
|
|
36
|
+
companyName: string;
|
|
37
|
+
contactEmail?: string;
|
|
38
|
+
contactName?: string;
|
|
39
|
+
contactPhone?: string;
|
|
40
|
+
status: InstallationStatus;
|
|
41
|
+
isOnline: boolean;
|
|
42
|
+
lastSeenAt?: Date;
|
|
43
|
+
employeeCount?: number;
|
|
44
|
+
clientCount?: number;
|
|
45
|
+
version?: string;
|
|
46
|
+
notes?: string;
|
|
47
|
+
createdById: string;
|
|
48
|
+
createdAt: Date;
|
|
49
|
+
updatedAt: Date;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface HeartbeatMetrics {
|
|
53
|
+
employeeCount: number;
|
|
54
|
+
clientCount: number;
|
|
55
|
+
version: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface LicenseCache {
|
|
59
|
+
status: LicenseStatus;
|
|
60
|
+
timestamp: number;
|
|
61
|
+
lastSuccessfulValidation: number;
|
|
62
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"lib": ["ES2022"],
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"declarationMap": true,
|
|
9
|
+
"outDir": "./dist",
|
|
10
|
+
"rootDir": "./src",
|
|
11
|
+
"strict": true,
|
|
12
|
+
"esModuleInterop": true,
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true,
|
|
15
|
+
"resolveJsonModule": true,
|
|
16
|
+
"isolatedModules": true
|
|
17
|
+
},
|
|
18
|
+
"include": ["src/**/*"],
|
|
19
|
+
"exclude": ["node_modules", "dist"]
|
|
20
|
+
}
|