@platform-modules/foreign-ministry 1.2.15 → 1.2.16

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.
@@ -125,6 +125,11 @@ const TelephoneDirectoryModel_1 = require("./models/TelephoneDirectoryModel");
125
125
  const RoutingGroupsModel_1 = require("./models/RoutingGroupsModel");
126
126
  const RoutingGroupUsersModel_1 = require("./models/RoutingGroupUsersModel");
127
127
  const IssueTypesModel_1 = require("./models/IssueTypesModel");
128
+ const EmployeeCardRequestsModel_1 = require("./models/EmployeeCardRequestsModel");
129
+ const EmployeeCardApprovalsModel_1 = require("./models/EmployeeCardApprovalsModel");
130
+ const EmployeeCardAttachmentsModel_1 = require("./models/EmployeeCardAttachmentsModel");
131
+ const EmployeeCardChatsModel_1 = require("./models/EmployeeCardChatsModel");
132
+ const EmployeeCardWorkFlowModel_1 = require("./models/EmployeeCardWorkFlowModel");
128
133
  exports.AppDataSource = new typeorm_1.DataSource({
129
134
  type: 'postgres',
130
135
  host: process.env.DB_HOST || 'localhost',
@@ -254,6 +259,11 @@ exports.AppDataSource = new typeorm_1.DataSource({
254
259
  TelephoneDirectoryModel_1.TelephoneDirectory,
255
260
  RoutingGroupsModel_1.RoutingGroups,
256
261
  IssueTypesModel_1.IssueTypes,
257
- RoutingGroupUsersModel_1.RoutingGroupUsers
262
+ RoutingGroupUsersModel_1.RoutingGroupUsers,
263
+ EmployeeCardRequestsModel_1.EmployeeCardRequests,
264
+ EmployeeCardApprovalsModel_1.EmployeeCardApprovalDetails,
265
+ EmployeeCardAttachmentsModel_1.EmployeeCardAttachments,
266
+ EmployeeCardChatsModel_1.EmployeeCardChat,
267
+ EmployeeCardWorkFlowModel_1.EmployeeCardWorkFlow
258
268
  ],
259
269
  });
package/dist/index.d.ts CHANGED
@@ -163,3 +163,8 @@ export * from './models/CountryMasterModel';
163
163
  export * from './models/NationalityMasterModel';
164
164
  export * from './models/OfficeMasterModel';
165
165
  export * from './models/RoutingGroupUsersModel';
166
+ export * from './models/EmployeeCardRequestsModel';
167
+ export * from './models/EmployeeCardApprovalsModel';
168
+ export * from './models/EmployeeCardWorkFlowModel';
169
+ export * from './models/EmployeeCardChatsModel';
170
+ export * from './models/EmployeeCardAttachmentsModel';
package/dist/index.js CHANGED
@@ -195,3 +195,8 @@ __exportStar(require("./models/CountryMasterModel"), exports);
195
195
  __exportStar(require("./models/NationalityMasterModel"), exports);
196
196
  __exportStar(require("./models/OfficeMasterModel"), exports);
197
197
  __exportStar(require("./models/RoutingGroupUsersModel"), exports);
198
+ __exportStar(require("./models/EmployeeCardRequestsModel"), exports);
199
+ __exportStar(require("./models/EmployeeCardApprovalsModel"), exports);
200
+ __exportStar(require("./models/EmployeeCardWorkFlowModel"), exports);
201
+ __exportStar(require("./models/EmployeeCardChatsModel"), exports);
202
+ __exportStar(require("./models/EmployeeCardAttachmentsModel"), exports);
@@ -0,0 +1,31 @@
1
+ import { BaseModel } from './BaseModel';
2
+ /**
3
+ * Approval Status Enum
4
+ */
5
+ export declare enum EmployeeCardApprovalStatus {
6
+ PENDING = "Pending",
7
+ APPROVED = "Approved",
8
+ REJECTED = "Rejected",
9
+ IN_PROGRESS = "In Progress",
10
+ CANCELLED = "Cancelled"
11
+ }
12
+ /**
13
+ * Employee Card Approval Details Table
14
+ * Stores approval information for each level of the workflow
15
+ * Supports workflow: Employee → Department Admin Office → US (if Special) → Security
16
+ */
17
+ export declare class EmployeeCardApprovalDetails extends BaseModel {
18
+ employee_card_request_id: number;
19
+ level: number;
20
+ approver_user_id: number | null;
21
+ approver_role_id: number | null;
22
+ delegate_user_id: number | null;
23
+ approved_by: number | null;
24
+ department_id: number | null;
25
+ section_id: number | null;
26
+ comment: string | null;
27
+ approval_status: EmployeeCardApprovalStatus;
28
+ is_allowed: boolean;
29
+ access_type: string | null;
30
+ constructor(employee_card_request_id: number, level: number, approver_user_id: number | null, approver_role_id: number | null, delegate_user_id: number | null, approved_by: number | null, department_id: number | null, section_id: number | null, comment: string | null, approval_status: EmployeeCardApprovalStatus, is_allowed: boolean, access_type: string | null);
31
+ }
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.EmployeeCardApprovalDetails = exports.EmployeeCardApprovalStatus = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ /**
16
+ * Approval Status Enum
17
+ */
18
+ var EmployeeCardApprovalStatus;
19
+ (function (EmployeeCardApprovalStatus) {
20
+ EmployeeCardApprovalStatus["PENDING"] = "Pending";
21
+ EmployeeCardApprovalStatus["APPROVED"] = "Approved";
22
+ EmployeeCardApprovalStatus["REJECTED"] = "Rejected";
23
+ EmployeeCardApprovalStatus["IN_PROGRESS"] = "In Progress";
24
+ EmployeeCardApprovalStatus["CANCELLED"] = "Cancelled";
25
+ })(EmployeeCardApprovalStatus || (exports.EmployeeCardApprovalStatus = EmployeeCardApprovalStatus = {}));
26
+ /**
27
+ * Employee Card Approval Details Table
28
+ * Stores approval information for each level of the workflow
29
+ * Supports workflow: Employee → Department Admin Office → US (if Special) → Security
30
+ */
31
+ let EmployeeCardApprovalDetails = class EmployeeCardApprovalDetails extends BaseModel_1.BaseModel {
32
+ constructor(employee_card_request_id, level, approver_user_id, approver_role_id, delegate_user_id, approved_by, department_id, section_id, comment, approval_status, is_allowed, access_type) {
33
+ super();
34
+ this.employee_card_request_id = employee_card_request_id;
35
+ this.level = level;
36
+ this.approver_user_id = approver_user_id;
37
+ this.approver_role_id = approver_role_id;
38
+ this.delegate_user_id = delegate_user_id;
39
+ this.approved_by = approved_by;
40
+ this.department_id = department_id;
41
+ this.section_id = section_id;
42
+ this.comment = comment;
43
+ this.approval_status = approval_status;
44
+ this.is_allowed = is_allowed;
45
+ this.access_type = access_type;
46
+ }
47
+ };
48
+ exports.EmployeeCardApprovalDetails = EmployeeCardApprovalDetails;
49
+ __decorate([
50
+ (0, typeorm_1.Column)({ type: 'int', nullable: false }),
51
+ __metadata("design:type", Number)
52
+ ], EmployeeCardApprovalDetails.prototype, "employee_card_request_id", void 0);
53
+ __decorate([
54
+ (0, typeorm_1.Column)({ type: 'int', nullable: false }),
55
+ __metadata("design:type", Number)
56
+ ], EmployeeCardApprovalDetails.prototype, "level", void 0);
57
+ __decorate([
58
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
59
+ __metadata("design:type", Object)
60
+ ], EmployeeCardApprovalDetails.prototype, "approver_user_id", void 0);
61
+ __decorate([
62
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
63
+ __metadata("design:type", Object)
64
+ ], EmployeeCardApprovalDetails.prototype, "approver_role_id", void 0);
65
+ __decorate([
66
+ (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
67
+ __metadata("design:type", Object)
68
+ ], EmployeeCardApprovalDetails.prototype, "delegate_user_id", void 0);
69
+ __decorate([
70
+ (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
71
+ __metadata("design:type", Object)
72
+ ], EmployeeCardApprovalDetails.prototype, "approved_by", void 0);
73
+ __decorate([
74
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
75
+ __metadata("design:type", Object)
76
+ ], EmployeeCardApprovalDetails.prototype, "department_id", void 0);
77
+ __decorate([
78
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
79
+ __metadata("design:type", Object)
80
+ ], EmployeeCardApprovalDetails.prototype, "section_id", void 0);
81
+ __decorate([
82
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
83
+ __metadata("design:type", Object)
84
+ ], EmployeeCardApprovalDetails.prototype, "comment", void 0);
85
+ __decorate([
86
+ (0, typeorm_1.Column)({ type: 'enum', enum: EmployeeCardApprovalStatus, default: EmployeeCardApprovalStatus.PENDING, nullable: false }),
87
+ __metadata("design:type", String)
88
+ ], EmployeeCardApprovalDetails.prototype, "approval_status", void 0);
89
+ __decorate([
90
+ (0, typeorm_1.Column)({ type: 'boolean', default: true, nullable: false }),
91
+ __metadata("design:type", Boolean)
92
+ ], EmployeeCardApprovalDetails.prototype, "is_allowed", void 0);
93
+ __decorate([
94
+ (0, typeorm_1.Column)({ type: 'varchar', length: 50, nullable: true }),
95
+ __metadata("design:type", Object)
96
+ ], EmployeeCardApprovalDetails.prototype, "access_type", void 0);
97
+ exports.EmployeeCardApprovalDetails = EmployeeCardApprovalDetails = __decorate([
98
+ (0, typeorm_1.Entity)({ name: 'employee_card_approvals' }),
99
+ __metadata("design:paramtypes", [Number, Number, Object, Object, Object, Object, Object, Object, Object, String, Boolean, Object])
100
+ ], EmployeeCardApprovalDetails);
@@ -0,0 +1,17 @@
1
+ import { BaseModel } from './BaseModel';
2
+ /**
3
+ * Employee Card Attachments Table
4
+ * Stores file attachments related to employee card requests
5
+ * Can be attached during initial request or via chat
6
+ */
7
+ export declare class EmployeeCardAttachments extends BaseModel {
8
+ employee_card_request_id: number;
9
+ attached_by_user_id: number;
10
+ file_url: string;
11
+ file_name: string | null;
12
+ file_type: string | null;
13
+ file_size: number | null;
14
+ chat_id: number | null;
15
+ description: string | null;
16
+ constructor(employee_card_request_id: number, attached_by_user_id: number, file_url: string, file_name: string | null, file_type: string | null, file_size: number | null, chat_id: number | null, description: string | null);
17
+ }
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.EmployeeCardAttachments = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ /**
16
+ * Employee Card Attachments Table
17
+ * Stores file attachments related to employee card requests
18
+ * Can be attached during initial request or via chat
19
+ */
20
+ let EmployeeCardAttachments = class EmployeeCardAttachments extends BaseModel_1.BaseModel {
21
+ constructor(employee_card_request_id, attached_by_user_id, file_url, file_name, file_type, file_size, chat_id, description) {
22
+ super();
23
+ this.employee_card_request_id = employee_card_request_id;
24
+ this.attached_by_user_id = attached_by_user_id;
25
+ this.file_url = file_url;
26
+ this.file_name = file_name;
27
+ this.file_type = file_type;
28
+ this.file_size = file_size;
29
+ this.chat_id = chat_id;
30
+ this.description = description;
31
+ }
32
+ };
33
+ exports.EmployeeCardAttachments = EmployeeCardAttachments;
34
+ __decorate([
35
+ (0, typeorm_1.Column)({ type: 'int', nullable: false }),
36
+ __metadata("design:type", Number)
37
+ ], EmployeeCardAttachments.prototype, "employee_card_request_id", void 0);
38
+ __decorate([
39
+ (0, typeorm_1.Column)({ type: 'int', nullable: false }),
40
+ __metadata("design:type", Number)
41
+ ], EmployeeCardAttachments.prototype, "attached_by_user_id", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.Column)({ type: 'varchar', length: 500, nullable: false }),
44
+ __metadata("design:type", String)
45
+ ], EmployeeCardAttachments.prototype, "file_url", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
48
+ __metadata("design:type", Object)
49
+ ], EmployeeCardAttachments.prototype, "file_name", void 0);
50
+ __decorate([
51
+ (0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
52
+ __metadata("design:type", Object)
53
+ ], EmployeeCardAttachments.prototype, "file_type", void 0);
54
+ __decorate([
55
+ (0, typeorm_1.Column)({ type: 'bigint', nullable: true }),
56
+ __metadata("design:type", Object)
57
+ ], EmployeeCardAttachments.prototype, "file_size", void 0);
58
+ __decorate([
59
+ (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
60
+ __metadata("design:type", Object)
61
+ ], EmployeeCardAttachments.prototype, "chat_id", void 0);
62
+ __decorate([
63
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
64
+ __metadata("design:type", Object)
65
+ ], EmployeeCardAttachments.prototype, "description", void 0);
66
+ exports.EmployeeCardAttachments = EmployeeCardAttachments = __decorate([
67
+ (0, typeorm_1.Entity)({ name: 'employee_card_attachments' }),
68
+ __metadata("design:paramtypes", [Number, Number, String, Object, Object, Object, Object, Object])
69
+ ], EmployeeCardAttachments);
@@ -0,0 +1,19 @@
1
+ import { BaseModel } from './BaseModel';
2
+ /**
3
+ * Employee Card Chat/Communication Table
4
+ * Stores messages/comments between the requester and approvers
5
+ * Allows discussion regarding the employee card request
6
+ */
7
+ export declare class EmployeeCardChat extends BaseModel {
8
+ employee_card_request_id: number;
9
+ content: string;
10
+ sender_user_id: number;
11
+ service_id: number | null;
12
+ sub_service_id: number | null;
13
+ role_id: number | null;
14
+ status: string | null;
15
+ department_id: number | null;
16
+ section_id: number | null;
17
+ is_internal: boolean | null;
18
+ constructor(employee_card_request_id: number, content: string, sender_user_id: number, service_id: number | null, sub_service_id: number | null, role_id: number | null, status: string | null, department_id: number | null, section_id: number | null, is_internal: boolean | null);
19
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.EmployeeCardChat = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ /**
16
+ * Employee Card Chat/Communication Table
17
+ * Stores messages/comments between the requester and approvers
18
+ * Allows discussion regarding the employee card request
19
+ */
20
+ let EmployeeCardChat = class EmployeeCardChat extends BaseModel_1.BaseModel {
21
+ constructor(employee_card_request_id, content, sender_user_id, service_id, sub_service_id, role_id, status, department_id, section_id, is_internal) {
22
+ super();
23
+ this.employee_card_request_id = employee_card_request_id;
24
+ this.content = content;
25
+ this.sender_user_id = sender_user_id;
26
+ this.service_id = service_id;
27
+ this.sub_service_id = sub_service_id;
28
+ this.role_id = role_id;
29
+ this.status = status;
30
+ this.department_id = department_id;
31
+ this.section_id = section_id;
32
+ this.is_internal = is_internal;
33
+ }
34
+ };
35
+ exports.EmployeeCardChat = EmployeeCardChat;
36
+ __decorate([
37
+ (0, typeorm_1.Column)({ type: 'int', nullable: false }),
38
+ __metadata("design:type", Number)
39
+ ], EmployeeCardChat.prototype, "employee_card_request_id", void 0);
40
+ __decorate([
41
+ (0, typeorm_1.Column)({ type: 'text', nullable: false }),
42
+ __metadata("design:type", String)
43
+ ], EmployeeCardChat.prototype, "content", void 0);
44
+ __decorate([
45
+ (0, typeorm_1.Column)({ type: 'int', nullable: false }),
46
+ __metadata("design:type", Number)
47
+ ], EmployeeCardChat.prototype, "sender_user_id", void 0);
48
+ __decorate([
49
+ (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
50
+ __metadata("design:type", Object)
51
+ ], EmployeeCardChat.prototype, "service_id", void 0);
52
+ __decorate([
53
+ (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
54
+ __metadata("design:type", Object)
55
+ ], EmployeeCardChat.prototype, "sub_service_id", void 0);
56
+ __decorate([
57
+ (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
58
+ __metadata("design:type", Object)
59
+ ], EmployeeCardChat.prototype, "role_id", void 0);
60
+ __decorate([
61
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
62
+ __metadata("design:type", Object)
63
+ ], EmployeeCardChat.prototype, "status", void 0);
64
+ __decorate([
65
+ (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
66
+ __metadata("design:type", Object)
67
+ ], EmployeeCardChat.prototype, "department_id", void 0);
68
+ __decorate([
69
+ (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
70
+ __metadata("design:type", Object)
71
+ ], EmployeeCardChat.prototype, "section_id", void 0);
72
+ __decorate([
73
+ (0, typeorm_1.Column)({ type: 'boolean', default: false, nullable: true }),
74
+ __metadata("design:type", Object)
75
+ ], EmployeeCardChat.prototype, "is_internal", void 0);
76
+ exports.EmployeeCardChat = EmployeeCardChat = __decorate([
77
+ (0, typeorm_1.Entity)({ name: 'employee_card_chats' }),
78
+ __metadata("design:paramtypes", [Number, String, Number, Object, Object, Object, Object, Object, Object, Object])
79
+ ], EmployeeCardChat);
@@ -0,0 +1,40 @@
1
+ import { BaseModel } from './BaseModel';
2
+ /**
3
+ * Employee Card Request Status Enum
4
+ */
5
+ export declare enum EmployeeCardRequestStatus {
6
+ PENDING = "Pending",
7
+ APPROVED = "Approved",
8
+ REJECTED = "Rejected",
9
+ CANCELLED = "Cancelled"
10
+ }
11
+ /**
12
+ * Access Type Enum - Normal or Special
13
+ */
14
+ export declare enum AccessType {
15
+ NORMAL = "Normal",
16
+ SPECIAL = "Special"
17
+ }
18
+ /**
19
+ * Main Employee Card Request Table (FM020)
20
+ * This table stores the primary employee card request data
21
+ */
22
+ export declare class EmployeeCardRequests extends BaseModel {
23
+ user_id: number;
24
+ req_user_department_id: number | null;
25
+ req_user_section_id: number | null;
26
+ service_id: number | null;
27
+ sub_service_id: number | null;
28
+ status: EmployeeCardRequestStatus;
29
+ workflow_execution_id: string | null;
30
+ number: string | null;
31
+ name: string | null;
32
+ job_title: string | null;
33
+ reason_for_request: string | null;
34
+ date_of_joining: Date | null;
35
+ date_of_issue: Date | null;
36
+ access_type: AccessType;
37
+ photo_url: string | null;
38
+ photo_file_name: string | null;
39
+ constructor(user_id: number, req_user_department_id: number | null, req_user_section_id: number | null, service_id: number | null, sub_service_id: number | null, status: EmployeeCardRequestStatus, workflow_execution_id: string | null, number: string | null, name: string | null, job_title: string | null, reason_for_request: string | null, date_of_joining: Date | null, date_of_issue: Date | null, access_type: AccessType, photo_url: string | null, photo_file_name: string | null);
40
+ }
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.EmployeeCardRequests = exports.AccessType = exports.EmployeeCardRequestStatus = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ /**
16
+ * Employee Card Request Status Enum
17
+ */
18
+ var EmployeeCardRequestStatus;
19
+ (function (EmployeeCardRequestStatus) {
20
+ EmployeeCardRequestStatus["PENDING"] = "Pending";
21
+ EmployeeCardRequestStatus["APPROVED"] = "Approved";
22
+ EmployeeCardRequestStatus["REJECTED"] = "Rejected";
23
+ EmployeeCardRequestStatus["CANCELLED"] = "Cancelled";
24
+ })(EmployeeCardRequestStatus || (exports.EmployeeCardRequestStatus = EmployeeCardRequestStatus = {}));
25
+ /**
26
+ * Access Type Enum - Normal or Special
27
+ */
28
+ var AccessType;
29
+ (function (AccessType) {
30
+ AccessType["NORMAL"] = "Normal";
31
+ AccessType["SPECIAL"] = "Special";
32
+ })(AccessType || (exports.AccessType = AccessType = {}));
33
+ /**
34
+ * Main Employee Card Request Table (FM020)
35
+ * This table stores the primary employee card request data
36
+ */
37
+ let EmployeeCardRequests = class EmployeeCardRequests extends BaseModel_1.BaseModel {
38
+ constructor(user_id, req_user_department_id, req_user_section_id, service_id, sub_service_id, status, workflow_execution_id, number, name, job_title, reason_for_request, date_of_joining, date_of_issue, access_type, photo_url, photo_file_name) {
39
+ super();
40
+ this.user_id = user_id;
41
+ this.req_user_department_id = req_user_department_id;
42
+ this.req_user_section_id = req_user_section_id;
43
+ this.service_id = service_id;
44
+ this.sub_service_id = sub_service_id;
45
+ this.status = status;
46
+ this.workflow_execution_id = workflow_execution_id;
47
+ this.number = number;
48
+ this.name = name;
49
+ this.job_title = job_title;
50
+ this.reason_for_request = reason_for_request;
51
+ this.date_of_joining = date_of_joining;
52
+ this.date_of_issue = date_of_issue;
53
+ this.access_type = access_type;
54
+ this.photo_url = photo_url;
55
+ this.photo_file_name = photo_file_name;
56
+ }
57
+ };
58
+ exports.EmployeeCardRequests = EmployeeCardRequests;
59
+ __decorate([
60
+ (0, typeorm_1.Column)({ type: 'int', nullable: false }),
61
+ __metadata("design:type", Number)
62
+ ], EmployeeCardRequests.prototype, "user_id", void 0);
63
+ __decorate([
64
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
65
+ __metadata("design:type", Object)
66
+ ], EmployeeCardRequests.prototype, "req_user_department_id", void 0);
67
+ __decorate([
68
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
69
+ __metadata("design:type", Object)
70
+ ], EmployeeCardRequests.prototype, "req_user_section_id", void 0);
71
+ __decorate([
72
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
73
+ __metadata("design:type", Object)
74
+ ], EmployeeCardRequests.prototype, "service_id", void 0);
75
+ __decorate([
76
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
77
+ __metadata("design:type", Object)
78
+ ], EmployeeCardRequests.prototype, "sub_service_id", void 0);
79
+ __decorate([
80
+ (0, typeorm_1.Column)({ type: 'enum', enum: EmployeeCardRequestStatus, default: EmployeeCardRequestStatus.PENDING, nullable: false }),
81
+ __metadata("design:type", String)
82
+ ], EmployeeCardRequests.prototype, "status", void 0);
83
+ __decorate([
84
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
85
+ __metadata("design:type", Object)
86
+ ], EmployeeCardRequests.prototype, "workflow_execution_id", void 0);
87
+ __decorate([
88
+ (0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
89
+ __metadata("design:type", Object)
90
+ ], EmployeeCardRequests.prototype, "number", void 0);
91
+ __decorate([
92
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
93
+ __metadata("design:type", Object)
94
+ ], EmployeeCardRequests.prototype, "name", void 0);
95
+ __decorate([
96
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
97
+ __metadata("design:type", Object)
98
+ ], EmployeeCardRequests.prototype, "job_title", void 0);
99
+ __decorate([
100
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
101
+ __metadata("design:type", Object)
102
+ ], EmployeeCardRequests.prototype, "reason_for_request", void 0);
103
+ __decorate([
104
+ (0, typeorm_1.Column)({ type: 'date', nullable: true }),
105
+ __metadata("design:type", Object)
106
+ ], EmployeeCardRequests.prototype, "date_of_joining", void 0);
107
+ __decorate([
108
+ (0, typeorm_1.Column)({ type: 'date', nullable: true }),
109
+ __metadata("design:type", Object)
110
+ ], EmployeeCardRequests.prototype, "date_of_issue", void 0);
111
+ __decorate([
112
+ (0, typeorm_1.Column)({ type: 'enum', enum: AccessType, default: AccessType.NORMAL, nullable: false }),
113
+ __metadata("design:type", String)
114
+ ], EmployeeCardRequests.prototype, "access_type", void 0);
115
+ __decorate([
116
+ (0, typeorm_1.Column)({ type: 'varchar', length: 500, nullable: true }),
117
+ __metadata("design:type", Object)
118
+ ], EmployeeCardRequests.prototype, "photo_url", void 0);
119
+ __decorate([
120
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
121
+ __metadata("design:type", Object)
122
+ ], EmployeeCardRequests.prototype, "photo_file_name", void 0);
123
+ exports.EmployeeCardRequests = EmployeeCardRequests = __decorate([
124
+ (0, typeorm_1.Entity)({ name: 'employee_card_requests' }),
125
+ __metadata("design:paramtypes", [Number, Object, Object, Object, Object, String, Object, Object, Object, Object, Object, Object, Object, String, Object, Object])
126
+ ], EmployeeCardRequests);
@@ -0,0 +1,34 @@
1
+ import { BaseModel } from './BaseModel';
2
+ /**
3
+ * Workflow Status Enum
4
+ */
5
+ export declare enum EmployeeCardWorkFlowStatus {
6
+ COMPLETED = "Completed",
7
+ NOT_YET_STARTED = "Not Yet Started",
8
+ PENDING = "Pending",
9
+ IN_PROGRESS = "In Progress"
10
+ }
11
+ /**
12
+ * Employee Card Workflow Table
13
+ * Tracks the progress of the request through different workflow stages
14
+ * Provides a timeline/audit trail of the approval process
15
+ *
16
+ * Workflow paths:
17
+ * - Normal: Employee → Department Admin Office → Security
18
+ * - Special: Employee → Department Admin Office → US → Security
19
+ */
20
+ export declare class EmployeeCardWorkFlow extends BaseModel {
21
+ employee_card_request_id: number;
22
+ employee_card_approval_details_id: number;
23
+ content: string;
24
+ status: EmployeeCardWorkFlowStatus;
25
+ user_id: number | null;
26
+ role_id: number | null;
27
+ department_id: number | null;
28
+ section_id: number | null;
29
+ level: number;
30
+ access_type: string | null;
31
+ action_taken: string | null;
32
+ action_date: Date | null;
33
+ constructor(employee_card_request_id: number, employee_card_approval_details_id: number, content: string, status: EmployeeCardWorkFlowStatus, user_id: number | null, role_id: number | null, department_id: number | null, section_id: number | null, level: number, access_type: string | null, action_taken: string | null, action_date: Date | null);
34
+ }
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.EmployeeCardWorkFlow = exports.EmployeeCardWorkFlowStatus = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ /**
16
+ * Workflow Status Enum
17
+ */
18
+ var EmployeeCardWorkFlowStatus;
19
+ (function (EmployeeCardWorkFlowStatus) {
20
+ EmployeeCardWorkFlowStatus["COMPLETED"] = "Completed";
21
+ EmployeeCardWorkFlowStatus["NOT_YET_STARTED"] = "Not Yet Started";
22
+ EmployeeCardWorkFlowStatus["PENDING"] = "Pending";
23
+ EmployeeCardWorkFlowStatus["IN_PROGRESS"] = "In Progress";
24
+ })(EmployeeCardWorkFlowStatus || (exports.EmployeeCardWorkFlowStatus = EmployeeCardWorkFlowStatus = {}));
25
+ /**
26
+ * Employee Card Workflow Table
27
+ * Tracks the progress of the request through different workflow stages
28
+ * Provides a timeline/audit trail of the approval process
29
+ *
30
+ * Workflow paths:
31
+ * - Normal: Employee → Department Admin Office → Security
32
+ * - Special: Employee → Department Admin Office → US → Security
33
+ */
34
+ let EmployeeCardWorkFlow = class EmployeeCardWorkFlow extends BaseModel_1.BaseModel {
35
+ constructor(employee_card_request_id, employee_card_approval_details_id, content, status, user_id, role_id, department_id, section_id, level, access_type, action_taken, action_date) {
36
+ super();
37
+ this.employee_card_request_id = employee_card_request_id;
38
+ this.employee_card_approval_details_id = employee_card_approval_details_id;
39
+ this.content = content;
40
+ this.status = status;
41
+ this.user_id = user_id;
42
+ this.role_id = role_id;
43
+ this.department_id = department_id;
44
+ this.section_id = section_id;
45
+ this.level = level;
46
+ this.access_type = access_type;
47
+ this.action_taken = action_taken;
48
+ this.action_date = action_date;
49
+ }
50
+ };
51
+ exports.EmployeeCardWorkFlow = EmployeeCardWorkFlow;
52
+ __decorate([
53
+ (0, typeorm_1.Column)({ type: 'int', nullable: false }),
54
+ __metadata("design:type", Number)
55
+ ], EmployeeCardWorkFlow.prototype, "employee_card_request_id", void 0);
56
+ __decorate([
57
+ (0, typeorm_1.Column)({ type: 'int', nullable: false, default: 0 }),
58
+ __metadata("design:type", Number)
59
+ ], EmployeeCardWorkFlow.prototype, "employee_card_approval_details_id", void 0);
60
+ __decorate([
61
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: false }),
62
+ __metadata("design:type", String)
63
+ ], EmployeeCardWorkFlow.prototype, "content", void 0);
64
+ __decorate([
65
+ (0, typeorm_1.Column)({ type: 'enum', enum: EmployeeCardWorkFlowStatus, default: EmployeeCardWorkFlowStatus.NOT_YET_STARTED, nullable: false }),
66
+ __metadata("design:type", String)
67
+ ], EmployeeCardWorkFlow.prototype, "status", void 0);
68
+ __decorate([
69
+ (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
70
+ __metadata("design:type", Object)
71
+ ], EmployeeCardWorkFlow.prototype, "user_id", void 0);
72
+ __decorate([
73
+ (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
74
+ __metadata("design:type", Object)
75
+ ], EmployeeCardWorkFlow.prototype, "role_id", void 0);
76
+ __decorate([
77
+ (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
78
+ __metadata("design:type", Object)
79
+ ], EmployeeCardWorkFlow.prototype, "department_id", void 0);
80
+ __decorate([
81
+ (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
82
+ __metadata("design:type", Object)
83
+ ], EmployeeCardWorkFlow.prototype, "section_id", void 0);
84
+ __decorate([
85
+ (0, typeorm_1.Column)({ type: 'integer', nullable: false, default: 1 }),
86
+ __metadata("design:type", Number)
87
+ ], EmployeeCardWorkFlow.prototype, "level", void 0);
88
+ __decorate([
89
+ (0, typeorm_1.Column)({ type: 'varchar', length: 50, nullable: true }),
90
+ __metadata("design:type", Object)
91
+ ], EmployeeCardWorkFlow.prototype, "access_type", void 0);
92
+ __decorate([
93
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
94
+ __metadata("design:type", Object)
95
+ ], EmployeeCardWorkFlow.prototype, "action_taken", void 0);
96
+ __decorate([
97
+ (0, typeorm_1.Column)({ type: 'timestamptz', nullable: true }),
98
+ __metadata("design:type", Object)
99
+ ], EmployeeCardWorkFlow.prototype, "action_date", void 0);
100
+ exports.EmployeeCardWorkFlow = EmployeeCardWorkFlow = __decorate([
101
+ (0, typeorm_1.Entity)({ name: 'employee_card_work_flows' }),
102
+ __metadata("design:paramtypes", [Number, Number, String, String, Object, Object, Object, Object, Number, Object, Object, Object])
103
+ ], EmployeeCardWorkFlow);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platform-modules/foreign-ministry",
3
- "version": "1.2.15",
3
+ "version": "1.2.16",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -130,6 +130,11 @@ import { TelephoneDirectory } from './models/TelephoneDirectoryModel'
130
130
  import { RoutingGroups } from './models/RoutingGroupsModel';
131
131
  import { RoutingGroupUsers } from './models/RoutingGroupUsersModel';
132
132
  import { IssueTypes } from './models/IssueTypesModel';
133
+ import { EmployeeCardRequests } from './models/EmployeeCardRequestsModel';
134
+ import { EmployeeCardApprovalDetails } from './models/EmployeeCardApprovalsModel';
135
+ import { EmployeeCardAttachments } from './models/EmployeeCardAttachmentsModel';
136
+ import { EmployeeCardChat } from './models/EmployeeCardChatsModel';
137
+ import { EmployeeCardWorkFlow } from './models/EmployeeCardWorkFlowModel';
133
138
 
134
139
  export const AppDataSource = new DataSource({
135
140
  type: 'postgres',
@@ -260,6 +265,11 @@ export const AppDataSource = new DataSource({
260
265
  TelephoneDirectory,
261
266
  RoutingGroups,
262
267
  IssueTypes,
263
- RoutingGroupUsers
268
+ RoutingGroupUsers,
269
+ EmployeeCardRequests,
270
+ EmployeeCardApprovalDetails,
271
+ EmployeeCardAttachments,
272
+ EmployeeCardChat,
273
+ EmployeeCardWorkFlow
264
274
  ],
265
275
  });
package/src/index.ts CHANGED
@@ -162,4 +162,9 @@ export { TitleCategory } from './models/DiplomaticTitlesMasterModel';
162
162
  export * from './models/CountryMasterModel';
163
163
  export * from './models/NationalityMasterModel';
164
164
  export * from './models/OfficeMasterModel';
165
- export * from './models/RoutingGroupUsersModel';
165
+ export * from './models/RoutingGroupUsersModel';
166
+ export * from './models/EmployeeCardRequestsModel';
167
+ export * from './models/EmployeeCardApprovalsModel';
168
+ export * from './models/EmployeeCardWorkFlowModel';
169
+ export * from './models/EmployeeCardChatsModel';
170
+ export * from './models/EmployeeCardAttachmentsModel';
@@ -0,0 +1,87 @@
1
+ import { Column, Entity } from "typeorm";
2
+ import { BaseModel } from './BaseModel';
3
+
4
+ /**
5
+ * Approval Status Enum
6
+ */
7
+ export enum EmployeeCardApprovalStatus {
8
+ PENDING = "Pending",
9
+ APPROVED = "Approved",
10
+ REJECTED = "Rejected",
11
+ IN_PROGRESS = "In Progress",
12
+ CANCELLED = "Cancelled"
13
+ }
14
+
15
+ /**
16
+ * Employee Card Approval Details Table
17
+ * Stores approval information for each level of the workflow
18
+ * Supports workflow: Employee → Department Admin Office → US (if Special) → Security
19
+ */
20
+ @Entity({ name: 'employee_card_approvals' })
21
+ export class EmployeeCardApprovalDetails extends BaseModel {
22
+
23
+ @Column({ type: 'int', nullable: false })
24
+ employee_card_request_id: number; // Foreign key to employee_card_requests
25
+
26
+ @Column({ type: 'int', nullable: false })
27
+ level: number; // Approval level (1: Dept Admin, 2: US for Special/Security for Normal, 3: Security for Special)
28
+
29
+ @Column({ type: 'int', nullable: true })
30
+ approver_user_id: number | null;
31
+
32
+ @Column({ type: 'int', nullable: true })
33
+ approver_role_id: number | null;
34
+
35
+ @Column({ type: 'integer', nullable: true })
36
+ delegate_user_id: number | null; // If someone is delegating approval
37
+
38
+ @Column({ type: 'integer', nullable: true })
39
+ approved_by: number | null; // Actual user who approved (in case of delegation)
40
+
41
+ @Column({ type: 'int', nullable: true })
42
+ department_id: number | null;
43
+
44
+ @Column({ type: 'int', nullable: true })
45
+ section_id: number | null;
46
+
47
+ @Column({ type: 'text', nullable: true })
48
+ comment: string | null; // Approval/rejection comment
49
+
50
+ @Column({ type: 'enum', enum: EmployeeCardApprovalStatus, default: EmployeeCardApprovalStatus.PENDING, nullable: false })
51
+ approval_status: EmployeeCardApprovalStatus;
52
+
53
+ @Column({ type: 'boolean', default: true, nullable: false })
54
+ is_allowed: boolean; // Whether this approval step is allowed
55
+
56
+ @Column({ type: 'varchar', length: 50, nullable: true })
57
+ access_type: string | null; // Normal or Special - to track which path
58
+
59
+ constructor(
60
+ employee_card_request_id: number,
61
+ level: number,
62
+ approver_user_id: number | null,
63
+ approver_role_id: number | null,
64
+ delegate_user_id: number | null,
65
+ approved_by: number | null,
66
+ department_id: number | null,
67
+ section_id: number | null,
68
+ comment: string | null,
69
+ approval_status: EmployeeCardApprovalStatus,
70
+ is_allowed: boolean,
71
+ access_type: string | null
72
+ ) {
73
+ super();
74
+ this.employee_card_request_id = employee_card_request_id;
75
+ this.level = level;
76
+ this.approver_user_id = approver_user_id;
77
+ this.approver_role_id = approver_role_id;
78
+ this.delegate_user_id = delegate_user_id;
79
+ this.approved_by = approved_by;
80
+ this.department_id = department_id;
81
+ this.section_id = section_id;
82
+ this.comment = comment;
83
+ this.approval_status = approval_status;
84
+ this.is_allowed = is_allowed;
85
+ this.access_type = access_type;
86
+ }
87
+ }
@@ -0,0 +1,56 @@
1
+ import { Column, Entity } from "typeorm";
2
+ import { BaseModel } from './BaseModel';
3
+
4
+ /**
5
+ * Employee Card Attachments Table
6
+ * Stores file attachments related to employee card requests
7
+ * Can be attached during initial request or via chat
8
+ */
9
+ @Entity({ name: 'employee_card_attachments' })
10
+ export class EmployeeCardAttachments extends BaseModel {
11
+
12
+ @Column({ type: 'int', nullable: false })
13
+ employee_card_request_id: number; // Foreign key to employee_card_requests
14
+
15
+ @Column({ type: 'int', nullable: false })
16
+ attached_by_user_id: number; // User who uploaded the attachment
17
+
18
+ @Column({ type: 'varchar', length: 500, nullable: false })
19
+ file_url: string; // URL/path to the file
20
+
21
+ @Column({ type: 'varchar', length: 255, nullable: true })
22
+ file_name: string | null; // Original file name
23
+
24
+ @Column({ type: 'varchar', length: 100, nullable: true })
25
+ file_type: string | null; // MIME type (e.g., image/jpeg, application/pdf)
26
+
27
+ @Column({ type: 'bigint', nullable: true })
28
+ file_size: number | null; // File size in bytes
29
+
30
+ @Column({ type: 'integer', nullable: true })
31
+ chat_id: number | null; // Reference to chat message if attached via chat
32
+
33
+ @Column({ type: 'varchar', length: 255, nullable: true })
34
+ description: string | null; // Optional description of the attachment
35
+
36
+ constructor(
37
+ employee_card_request_id: number,
38
+ attached_by_user_id: number,
39
+ file_url: string,
40
+ file_name: string | null,
41
+ file_type: string | null,
42
+ file_size: number | null,
43
+ chat_id: number | null,
44
+ description: string | null
45
+ ) {
46
+ super();
47
+ this.employee_card_request_id = employee_card_request_id;
48
+ this.attached_by_user_id = attached_by_user_id;
49
+ this.file_url = file_url;
50
+ this.file_name = file_name;
51
+ this.file_type = file_type;
52
+ this.file_size = file_size;
53
+ this.chat_id = chat_id;
54
+ this.description = description;
55
+ }
56
+ }
@@ -0,0 +1,66 @@
1
+ import { Column, Entity } from "typeorm";
2
+ import { BaseModel } from './BaseModel';
3
+
4
+ /**
5
+ * Employee Card Chat/Communication Table
6
+ * Stores messages/comments between the requester and approvers
7
+ * Allows discussion regarding the employee card request
8
+ */
9
+ @Entity({ name: 'employee_card_chats' })
10
+ export class EmployeeCardChat extends BaseModel {
11
+
12
+ @Column({ type: 'int', nullable: false })
13
+ employee_card_request_id: number; // Foreign key to employee_card_requests
14
+
15
+ @Column({ type: 'text', nullable: false })
16
+ content: string; // Chat message content
17
+
18
+ @Column({ type: 'int', nullable: false })
19
+ sender_user_id: number; // User who sent the message
20
+
21
+ @Column({ type: 'integer', nullable: true })
22
+ service_id: number | null; // Service context
23
+
24
+ @Column({ type: 'integer', nullable: true })
25
+ sub_service_id: number | null; // Sub-service context
26
+
27
+ @Column({ type: 'integer', nullable: true })
28
+ role_id: number | null; // Role of the sender
29
+
30
+ @Column({ type: 'varchar', length: 255, nullable: true })
31
+ status: string | null; // Status of the request at the time of message
32
+
33
+ @Column({ type: 'integer', nullable: true })
34
+ department_id: number | null; // Department of the sender
35
+
36
+ @Column({ type: 'integer', nullable: true })
37
+ section_id: number | null; // Section of the sender
38
+
39
+ @Column({ type: 'boolean', default: false, nullable: true })
40
+ is_internal: boolean | null; // Flag to mark internal notes (visible only to approvers)
41
+
42
+ constructor(
43
+ employee_card_request_id: number,
44
+ content: string,
45
+ sender_user_id: number,
46
+ service_id: number | null,
47
+ sub_service_id: number | null,
48
+ role_id: number | null,
49
+ status: string | null,
50
+ department_id: number | null,
51
+ section_id: number | null,
52
+ is_internal: boolean | null
53
+ ) {
54
+ super();
55
+ this.employee_card_request_id = employee_card_request_id;
56
+ this.content = content;
57
+ this.sender_user_id = sender_user_id;
58
+ this.service_id = service_id;
59
+ this.sub_service_id = sub_service_id;
60
+ this.role_id = role_id;
61
+ this.status = status;
62
+ this.department_id = department_id;
63
+ this.section_id = section_id;
64
+ this.is_internal = is_internal;
65
+ }
66
+ }
@@ -0,0 +1,115 @@
1
+ import { Column, Entity } from "typeorm";
2
+ import { BaseModel } from './BaseModel';
3
+
4
+ /**
5
+ * Employee Card Request Status Enum
6
+ */
7
+ export enum EmployeeCardRequestStatus {
8
+ PENDING = "Pending",
9
+ APPROVED = "Approved",
10
+ REJECTED = "Rejected",
11
+ CANCELLED = "Cancelled"
12
+ }
13
+
14
+ /**
15
+ * Access Type Enum - Normal or Special
16
+ */
17
+ export enum AccessType {
18
+ NORMAL = "Normal",
19
+ SPECIAL = "Special"
20
+ }
21
+
22
+ /**
23
+ * Main Employee Card Request Table (FM020)
24
+ * This table stores the primary employee card request data
25
+ */
26
+ @Entity({ name: 'employee_card_requests' })
27
+ export class EmployeeCardRequests extends BaseModel {
28
+
29
+ // User and Department Information
30
+ @Column({ type: 'int', nullable: false })
31
+ user_id: number;
32
+
33
+ @Column({ type: 'int', nullable: true })
34
+ req_user_department_id: number | null;
35
+
36
+ @Column({ type: 'int', nullable: true })
37
+ req_user_section_id: number | null;
38
+
39
+ @Column({ type: 'int', nullable: true })
40
+ service_id: number | null;
41
+
42
+ @Column({ type: 'int', nullable: true })
43
+ sub_service_id: number | null;
44
+
45
+ // Request Status and Workflow
46
+ @Column({ type: 'enum', enum: EmployeeCardRequestStatus, default: EmployeeCardRequestStatus.PENDING, nullable: false })
47
+ status: EmployeeCardRequestStatus;
48
+
49
+ @Column({ type: 'varchar', length: 255, nullable: true })
50
+ workflow_execution_id: string | null;
51
+
52
+ @Column({ type: 'varchar', length: 100, nullable: true })
53
+ number: string | null;
54
+
55
+ @Column({ type: 'varchar', length: 255, nullable: true })
56
+ name: string | null;
57
+
58
+ @Column({ type: 'varchar', length: 255, nullable: true })
59
+ job_title: string | null;
60
+
61
+ @Column({ type: 'text', nullable: true })
62
+ reason_for_request: string | null;
63
+
64
+ @Column({ type: 'date', nullable: true })
65
+ date_of_joining: Date | null;
66
+
67
+ @Column({ type: 'date', nullable: true })
68
+ date_of_issue: Date | null;
69
+ @Column({ type: 'enum', enum: AccessType, default: AccessType.NORMAL, nullable: false })
70
+ access_type: AccessType; // Normal / Special (Radio Button)
71
+
72
+ // Photo from Profile (URL or reference)
73
+ @Column({ type: 'varchar', length: 500, nullable: true })
74
+ photo_url: string | null; // Photo pulled from profile data
75
+
76
+ @Column({ type: 'varchar', length: 255, nullable: true })
77
+ photo_file_name: string | null;
78
+
79
+ constructor(
80
+ user_id: number,
81
+ req_user_department_id: number | null,
82
+ req_user_section_id: number | null,
83
+ service_id: number | null,
84
+ sub_service_id: number | null,
85
+ status: EmployeeCardRequestStatus,
86
+ workflow_execution_id: string | null,
87
+ number: string | null,
88
+ name: string | null,
89
+ job_title: string | null,
90
+ reason_for_request: string | null,
91
+ date_of_joining: Date | null,
92
+ date_of_issue: Date | null,
93
+ access_type: AccessType,
94
+ photo_url: string | null,
95
+ photo_file_name: string | null
96
+ ) {
97
+ super();
98
+ this.user_id = user_id;
99
+ this.req_user_department_id = req_user_department_id;
100
+ this.req_user_section_id = req_user_section_id;
101
+ this.service_id = service_id;
102
+ this.sub_service_id = sub_service_id;
103
+ this.status = status;
104
+ this.workflow_execution_id = workflow_execution_id;
105
+ this.number = number;
106
+ this.name = name;
107
+ this.job_title = job_title;
108
+ this.reason_for_request = reason_for_request;
109
+ this.date_of_joining = date_of_joining;
110
+ this.date_of_issue = date_of_issue;
111
+ this.access_type = access_type;
112
+ this.photo_url = photo_url;
113
+ this.photo_file_name = photo_file_name;
114
+ }
115
+ }
@@ -0,0 +1,90 @@
1
+ import { Column, Entity } from "typeorm";
2
+ import { BaseModel } from './BaseModel';
3
+
4
+ /**
5
+ * Workflow Status Enum
6
+ */
7
+ export enum EmployeeCardWorkFlowStatus {
8
+ COMPLETED = "Completed",
9
+ NOT_YET_STARTED = "Not Yet Started",
10
+ PENDING = "Pending",
11
+ IN_PROGRESS = "In Progress"
12
+ }
13
+
14
+ /**
15
+ * Employee Card Workflow Table
16
+ * Tracks the progress of the request through different workflow stages
17
+ * Provides a timeline/audit trail of the approval process
18
+ *
19
+ * Workflow paths:
20
+ * - Normal: Employee → Department Admin Office → Security
21
+ * - Special: Employee → Department Admin Office → US → Security
22
+ */
23
+ @Entity({ name: 'employee_card_work_flows' })
24
+ export class EmployeeCardWorkFlow extends BaseModel {
25
+
26
+ @Column({ type: 'int', nullable: false })
27
+ employee_card_request_id: number; // Foreign key to employee_card_requests
28
+
29
+ @Column({ type: 'int', nullable: false, default: 0 })
30
+ employee_card_approval_details_id: number; // Foreign key to employee_card_approvals
31
+
32
+ @Column({ type: 'varchar', length: 255, nullable: false })
33
+ content: string; // Description of the workflow step (e.g., "Pending Department Admin Office Approval")
34
+
35
+ @Column({ type: 'enum', enum: EmployeeCardWorkFlowStatus, default: EmployeeCardWorkFlowStatus.NOT_YET_STARTED, nullable: false })
36
+ status: EmployeeCardWorkFlowStatus; // Current status of this workflow step
37
+
38
+ @Column({ type: 'integer', nullable: true })
39
+ user_id: number | null; // User responsible for this step
40
+
41
+ @Column({ type: 'integer', nullable: true })
42
+ role_id: number | null; // Role responsible for this step
43
+
44
+ @Column({ type: 'integer', nullable: true })
45
+ department_id: number | null; // Department involved in this step
46
+
47
+ @Column({ type: 'integer', nullable: true })
48
+ section_id: number | null; // Section involved in this step
49
+
50
+ @Column({ type: 'integer', nullable: false, default: 1 })
51
+ level: number; // Workflow level (1: Dept Admin, 2: US/Security, 3: Security for Special)
52
+
53
+ @Column({ type: 'varchar', length: 50, nullable: true })
54
+ access_type: string | null; // Normal or Special - to track workflow path
55
+
56
+ @Column({ type: 'varchar', length: 255, nullable: true })
57
+ action_taken: string | null; // Action taken (e.g., "Approved", "Rejected", "Forwarded")
58
+
59
+ @Column({ type: 'timestamptz', nullable: true })
60
+ action_date: Date | null; // When the action was taken
61
+
62
+ constructor(
63
+ employee_card_request_id: number,
64
+ employee_card_approval_details_id: number,
65
+ content: string,
66
+ status: EmployeeCardWorkFlowStatus,
67
+ user_id: number | null,
68
+ role_id: number | null,
69
+ department_id: number | null,
70
+ section_id: number | null,
71
+ level: number,
72
+ access_type: string | null,
73
+ action_taken: string | null,
74
+ action_date: Date | null
75
+ ) {
76
+ super();
77
+ this.employee_card_request_id = employee_card_request_id;
78
+ this.employee_card_approval_details_id = employee_card_approval_details_id;
79
+ this.content = content;
80
+ this.status = status;
81
+ this.user_id = user_id;
82
+ this.role_id = role_id;
83
+ this.department_id = department_id;
84
+ this.section_id = section_id;
85
+ this.level = level;
86
+ this.access_type = access_type;
87
+ this.action_taken = action_taken;
88
+ this.action_date = action_date;
89
+ }
90
+ }