@platform-modules/foreign-ministry 1.1.9 → 1.1.12

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.
@@ -78,6 +78,11 @@ const StayAfterHoursApprovalModel_1 = require("./models/StayAfterHoursApprovalMo
78
78
  const StayAfterHoursAttachmentModel_1 = require("./models/StayAfterHoursAttachmentModel");
79
79
  const StayAfterHoursChatModel_1 = require("./models/StayAfterHoursChatModel");
80
80
  const StayAfterHoursWorkflowModel_1 = require("./models/StayAfterHoursWorkflowModel");
81
+ const ServiceRequestsModel_1 = require("./models/ServiceRequestsModel");
82
+ const ServiceApprovalsModel_1 = require("./models/ServiceApprovalsModel");
83
+ const ServiceWorkFlowModel_1 = require("./models/ServiceWorkFlowModel");
84
+ const ServiceAttachmentsModel_1 = require("./models/ServiceAttachmentsModel");
85
+ const ServiceChatsModel_1 = require("./models/ServiceChatsModel");
81
86
  const WorkflowTask_1 = require("./models/WorkflowTask");
82
87
  const WorkflowTaskNames_1 = require("./models/WorkflowTaskNames");
83
88
  const WorkflowDefinitions_1 = require("./models/WorkflowDefinitions");
@@ -172,6 +177,11 @@ exports.AppDataSource = new typeorm_1.DataSource({
172
177
  StayAfterHoursApprovalModel_1.StayAfterHoursApprovalDetails,
173
178
  StayAfterHoursAttachmentModel_1.StayAfterHoursRequestAttachment,
174
179
  StayAfterHoursChatModel_1.StayAfterHoursRequestChat,
175
- StayAfterHoursWorkflowModel_1.StayAfterHoursWorkFlow
180
+ StayAfterHoursWorkflowModel_1.StayAfterHoursWorkFlow,
181
+ ServiceRequestsModel_1.ServiceRequests,
182
+ ServiceApprovalsModel_1.ServiceApprovals,
183
+ ServiceWorkFlowModel_1.ServiceWorkFlow,
184
+ ServiceAttachmentsModel_1.ServiceAttachments,
185
+ ServiceChatsModel_1.ServiceChats
176
186
  ],
177
187
  });
package/dist/index.d.ts CHANGED
@@ -77,3 +77,8 @@ export * from './models/StayAfterHoursApprovalModel';
77
77
  export * from './models/StayAfterHoursAttachmentModel';
78
78
  export * from './models/StayAfterHoursChatModel';
79
79
  export * from './models/StayAfterHoursWorkflowModel';
80
+ export * from './models/ServiceRequestsModel';
81
+ export * from './models/ServiceApprovalsModel';
82
+ export * from './models/ServiceWorkFlowModel';
83
+ export * from './models/ServiceAttachmentsModel';
84
+ export * from './models/ServiceChatsModel';
package/dist/index.js CHANGED
@@ -93,3 +93,8 @@ __exportStar(require("./models/StayAfterHoursApprovalModel"), exports);
93
93
  __exportStar(require("./models/StayAfterHoursAttachmentModel"), exports);
94
94
  __exportStar(require("./models/StayAfterHoursChatModel"), exports);
95
95
  __exportStar(require("./models/StayAfterHoursWorkflowModel"), exports);
96
+ __exportStar(require("./models/ServiceRequestsModel"), exports);
97
+ __exportStar(require("./models/ServiceApprovalsModel"), exports);
98
+ __exportStar(require("./models/ServiceWorkFlowModel"), exports);
99
+ __exportStar(require("./models/ServiceAttachmentsModel"), exports);
100
+ __exportStar(require("./models/ServiceChatsModel"), exports);
@@ -0,0 +1,23 @@
1
+ import { BaseModel } from './BaseModel';
2
+ import { ServiceRequests } from './ServiceRequestsModel';
3
+ export declare enum ServiceApprovalStatus {
4
+ PENDING = "Pending",
5
+ APPROVED = "Approved",
6
+ REJECTED = "Rejected",
7
+ SKIPPED = "Skipped",
8
+ IN_PROGRESS = "In Progress"
9
+ }
10
+ export declare class ServiceApprovals extends BaseModel {
11
+ service_request_id: number;
12
+ level: number;
13
+ approver_user_id: number | null;
14
+ approver_role_id: number;
15
+ comment: string | null;
16
+ approval_status: ServiceApprovalStatus;
17
+ action_date: Date;
18
+ department_id: number | null;
19
+ section_id: number | null;
20
+ approved_by: number | null;
21
+ serviceRequest?: ServiceRequests;
22
+ constructor(service_request_id: number, level: number, approver_role_id: number, approval_status: ServiceApprovalStatus, department_id: number | null, section_id: number | null, approved_by: number | null);
23
+ }
@@ -0,0 +1,85 @@
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.ServiceApprovals = exports.ServiceApprovalStatus = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ const ServiceRequestsModel_1 = require("./ServiceRequestsModel");
16
+ var ServiceApprovalStatus;
17
+ (function (ServiceApprovalStatus) {
18
+ ServiceApprovalStatus["PENDING"] = "Pending";
19
+ ServiceApprovalStatus["APPROVED"] = "Approved";
20
+ ServiceApprovalStatus["REJECTED"] = "Rejected";
21
+ ServiceApprovalStatus["SKIPPED"] = "Skipped";
22
+ ServiceApprovalStatus["IN_PROGRESS"] = "In Progress";
23
+ })(ServiceApprovalStatus || (exports.ServiceApprovalStatus = ServiceApprovalStatus = {}));
24
+ let ServiceApprovals = class ServiceApprovals extends BaseModel_1.BaseModel {
25
+ constructor(service_request_id, level, approver_role_id, approval_status, department_id, section_id, approved_by) {
26
+ super();
27
+ this.service_request_id = service_request_id;
28
+ this.level = level;
29
+ this.approver_role_id = approver_role_id;
30
+ this.approval_status = approval_status;
31
+ this.department_id = department_id;
32
+ this.section_id = section_id;
33
+ this.approved_by = approved_by;
34
+ }
35
+ };
36
+ exports.ServiceApprovals = ServiceApprovals;
37
+ __decorate([
38
+ (0, typeorm_1.Column)({ type: 'int' }),
39
+ __metadata("design:type", Number)
40
+ ], ServiceApprovals.prototype, "service_request_id", void 0);
41
+ __decorate([
42
+ (0, typeorm_1.Column)({ type: 'int' }),
43
+ __metadata("design:type", Number)
44
+ ], ServiceApprovals.prototype, "level", void 0);
45
+ __decorate([
46
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
47
+ __metadata("design:type", Object)
48
+ ], ServiceApprovals.prototype, "approver_user_id", void 0);
49
+ __decorate([
50
+ (0, typeorm_1.Column)({ type: 'int' }),
51
+ __metadata("design:type", Number)
52
+ ], ServiceApprovals.prototype, "approver_role_id", void 0);
53
+ __decorate([
54
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
55
+ __metadata("design:type", Object)
56
+ ], ServiceApprovals.prototype, "comment", void 0);
57
+ __decorate([
58
+ (0, typeorm_1.Column)({ type: 'enum', enum: ServiceApprovalStatus, default: ServiceApprovalStatus.PENDING }),
59
+ __metadata("design:type", String)
60
+ ], ServiceApprovals.prototype, "approval_status", void 0);
61
+ __decorate([
62
+ (0, typeorm_1.Column)({ type: 'timestamp', nullable: true }),
63
+ __metadata("design:type", Date)
64
+ ], ServiceApprovals.prototype, "action_date", void 0);
65
+ __decorate([
66
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
67
+ __metadata("design:type", Object)
68
+ ], ServiceApprovals.prototype, "department_id", void 0);
69
+ __decorate([
70
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
71
+ __metadata("design:type", Object)
72
+ ], ServiceApprovals.prototype, "section_id", void 0);
73
+ __decorate([
74
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
75
+ __metadata("design:type", Object)
76
+ ], ServiceApprovals.prototype, "approved_by", void 0);
77
+ __decorate([
78
+ (0, typeorm_1.ManyToOne)(() => ServiceRequestsModel_1.ServiceRequests, sr => sr.approvals),
79
+ (0, typeorm_1.JoinColumn)({ name: 'service_request_id' }),
80
+ __metadata("design:type", ServiceRequestsModel_1.ServiceRequests)
81
+ ], ServiceApprovals.prototype, "serviceRequest", void 0);
82
+ exports.ServiceApprovals = ServiceApprovals = __decorate([
83
+ (0, typeorm_1.Entity)({ name: 'service_approvals' }),
84
+ __metadata("design:paramtypes", [Number, Number, Number, String, Object, Object, Object])
85
+ ], ServiceApprovals);
@@ -0,0 +1,10 @@
1
+ import { BaseModel } from './BaseModel';
2
+ import { ServiceRequests } from './ServiceRequestsModel';
3
+ export declare class ServiceAttachments extends BaseModel {
4
+ service_request_id: number;
5
+ file_url: string;
6
+ file_name: string;
7
+ file_type: string;
8
+ serviceRequest?: ServiceRequests;
9
+ constructor(service_request_id: number, file_url: string, file_name: string);
10
+ }
@@ -0,0 +1,50 @@
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.ServiceAttachments = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ const ServiceRequestsModel_1 = require("./ServiceRequestsModel");
16
+ let ServiceAttachments = class ServiceAttachments extends BaseModel_1.BaseModel {
17
+ constructor(service_request_id, file_url, file_name) {
18
+ super();
19
+ this.service_request_id = service_request_id;
20
+ this.file_url = file_url;
21
+ this.file_name = file_name;
22
+ this.file_type = 'PDF';
23
+ }
24
+ };
25
+ exports.ServiceAttachments = ServiceAttachments;
26
+ __decorate([
27
+ (0, typeorm_1.Column)({ type: 'int' }),
28
+ __metadata("design:type", Number)
29
+ ], ServiceAttachments.prototype, "service_request_id", void 0);
30
+ __decorate([
31
+ (0, typeorm_1.Column)({ type: 'varchar', length: 500 }),
32
+ __metadata("design:type", String)
33
+ ], ServiceAttachments.prototype, "file_url", void 0);
34
+ __decorate([
35
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255 }),
36
+ __metadata("design:type", String)
37
+ ], ServiceAttachments.prototype, "file_name", void 0);
38
+ __decorate([
39
+ (0, typeorm_1.Column)({ type: 'varchar', length: 50, nullable: true }),
40
+ __metadata("design:type", String)
41
+ ], ServiceAttachments.prototype, "file_type", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.ManyToOne)(() => ServiceRequestsModel_1.ServiceRequests, sr => sr.attachments),
44
+ (0, typeorm_1.JoinColumn)({ name: 'service_request_id' }),
45
+ __metadata("design:type", ServiceRequestsModel_1.ServiceRequests)
46
+ ], ServiceAttachments.prototype, "serviceRequest", void 0);
47
+ exports.ServiceAttachments = ServiceAttachments = __decorate([
48
+ (0, typeorm_1.Entity)({ name: 'service_attachments' }),
49
+ __metadata("design:paramtypes", [Number, String, String])
50
+ ], ServiceAttachments);
@@ -0,0 +1,9 @@
1
+ import { BaseModel } from './BaseModel';
2
+ import { ServiceRequests } from './ServiceRequestsModel';
3
+ export declare class ServiceChats extends BaseModel {
4
+ service_request_id: number;
5
+ content: string;
6
+ sender_user_id: number;
7
+ serviceRequest?: ServiceRequests;
8
+ constructor(service_request_id: number, content: string, sender_user_id: number);
9
+ }
@@ -0,0 +1,45 @@
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.ServiceChats = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ const ServiceRequestsModel_1 = require("./ServiceRequestsModel");
16
+ let ServiceChats = class ServiceChats extends BaseModel_1.BaseModel {
17
+ constructor(service_request_id, content, sender_user_id) {
18
+ super();
19
+ this.service_request_id = service_request_id;
20
+ this.content = content;
21
+ this.sender_user_id = sender_user_id;
22
+ }
23
+ };
24
+ exports.ServiceChats = ServiceChats;
25
+ __decorate([
26
+ (0, typeorm_1.Column)({ type: 'int' }),
27
+ __metadata("design:type", Number)
28
+ ], ServiceChats.prototype, "service_request_id", void 0);
29
+ __decorate([
30
+ (0, typeorm_1.Column)({ type: 'text' }),
31
+ __metadata("design:type", String)
32
+ ], ServiceChats.prototype, "content", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.Column)({ type: 'int' }),
35
+ __metadata("design:type", Number)
36
+ ], ServiceChats.prototype, "sender_user_id", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.ManyToOne)(() => ServiceRequestsModel_1.ServiceRequests, sr => sr.chats),
39
+ (0, typeorm_1.JoinColumn)({ name: 'service_request_id' }),
40
+ __metadata("design:type", ServiceRequestsModel_1.ServiceRequests)
41
+ ], ServiceChats.prototype, "serviceRequest", void 0);
42
+ exports.ServiceChats = ServiceChats = __decorate([
43
+ (0, typeorm_1.Entity)({ name: 'service_chats' }),
44
+ __metadata("design:paramtypes", [Number, String, Number])
45
+ ], ServiceChats);
@@ -0,0 +1,41 @@
1
+ import { BaseModel } from './BaseModel';
2
+ import type { ServiceChats } from './ServiceChatsModel';
3
+ import type { ServiceApprovals } from './ServiceApprovalsModel';
4
+ import type { ServiceWorkFlow } from './ServiceWorkFlowModel';
5
+ import type { ServiceAttachments } from './ServiceAttachmentsModel';
6
+ export declare enum ServiceRequestStatus {
7
+ DRAFT = "Draft",
8
+ SUBMITTED = "Submitted",
9
+ PENDING = "Pending",
10
+ IN_PROGRESS = "In Progress",
11
+ APPROVED = "Approved",
12
+ REJECTED = "Rejected",
13
+ COMPLETED = "Completed",
14
+ CANCELLED = "Cancelled"
15
+ }
16
+ export declare class ServiceRequests extends BaseModel {
17
+ user_id: number;
18
+ employee_id: string;
19
+ employee_name: string;
20
+ grade: string | null;
21
+ designation_id: number | null;
22
+ department_id: number | null;
23
+ email_address: string;
24
+ contact_number: string;
25
+ request_date: Date;
26
+ request_status: ServiceRequestStatus;
27
+ request_close_date: Date | null;
28
+ remarks: string | null;
29
+ current_approval_level: number | null;
30
+ current_approver_id: number | null;
31
+ service_id: number | null;
32
+ sub_service_id: number | null;
33
+ section_id: number | null;
34
+ reporting_manager: number | null;
35
+ workflow_execution_id: string | null;
36
+ chats?: ServiceChats[];
37
+ approvals?: ServiceApprovals[];
38
+ workflows?: ServiceWorkFlow[];
39
+ attachments?: ServiceAttachments[];
40
+ constructor(user_id: number, employee_id: string, employee_name: string, email_address: string, contact_number: string, service_id: number | null, sub_service_id: number | null, section_id: number | null, reporting_manager: number | null);
41
+ }
@@ -0,0 +1,138 @@
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.ServiceRequests = exports.ServiceRequestStatus = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ var ServiceRequestStatus;
16
+ (function (ServiceRequestStatus) {
17
+ ServiceRequestStatus["DRAFT"] = "Draft";
18
+ ServiceRequestStatus["SUBMITTED"] = "Submitted";
19
+ ServiceRequestStatus["PENDING"] = "Pending";
20
+ ServiceRequestStatus["IN_PROGRESS"] = "In Progress";
21
+ ServiceRequestStatus["APPROVED"] = "Approved";
22
+ ServiceRequestStatus["REJECTED"] = "Rejected";
23
+ ServiceRequestStatus["COMPLETED"] = "Completed";
24
+ ServiceRequestStatus["CANCELLED"] = "Cancelled";
25
+ })(ServiceRequestStatus || (exports.ServiceRequestStatus = ServiceRequestStatus = {}));
26
+ let ServiceRequests = class ServiceRequests extends BaseModel_1.BaseModel {
27
+ constructor(user_id, employee_id, employee_name, email_address, contact_number, service_id, sub_service_id, section_id, reporting_manager) {
28
+ super();
29
+ this.user_id = user_id;
30
+ this.employee_id = employee_id;
31
+ this.employee_name = employee_name;
32
+ this.email_address = email_address;
33
+ this.contact_number = contact_number;
34
+ this.request_date = new Date();
35
+ this.request_status = ServiceRequestStatus.PENDING;
36
+ this.service_id = service_id;
37
+ this.sub_service_id = sub_service_id;
38
+ this.section_id = section_id;
39
+ this.reporting_manager = reporting_manager;
40
+ }
41
+ };
42
+ exports.ServiceRequests = ServiceRequests;
43
+ __decorate([
44
+ (0, typeorm_1.Column)({ type: 'int' }),
45
+ __metadata("design:type", Number)
46
+ ], ServiceRequests.prototype, "user_id", void 0);
47
+ __decorate([
48
+ (0, typeorm_1.Column)({ type: 'varchar', length: 100 }),
49
+ __metadata("design:type", String)
50
+ ], ServiceRequests.prototype, "employee_id", void 0);
51
+ __decorate([
52
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255 }),
53
+ __metadata("design:type", String)
54
+ ], ServiceRequests.prototype, "employee_name", void 0);
55
+ __decorate([
56
+ (0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
57
+ __metadata("design:type", Object)
58
+ ], ServiceRequests.prototype, "grade", void 0);
59
+ __decorate([
60
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
61
+ __metadata("design:type", Object)
62
+ ], ServiceRequests.prototype, "designation_id", void 0);
63
+ __decorate([
64
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
65
+ __metadata("design:type", Object)
66
+ ], ServiceRequests.prototype, "department_id", void 0);
67
+ __decorate([
68
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255 }),
69
+ __metadata("design:type", String)
70
+ ], ServiceRequests.prototype, "email_address", void 0);
71
+ __decorate([
72
+ (0, typeorm_1.Column)({ type: 'varchar', length: 20 }),
73
+ __metadata("design:type", String)
74
+ ], ServiceRequests.prototype, "contact_number", void 0);
75
+ __decorate([
76
+ (0, typeorm_1.Column)({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }),
77
+ __metadata("design:type", Date)
78
+ ], ServiceRequests.prototype, "request_date", void 0);
79
+ __decorate([
80
+ (0, typeorm_1.Column)({ type: 'enum', enum: ServiceRequestStatus, default: ServiceRequestStatus.PENDING }),
81
+ __metadata("design:type", String)
82
+ ], ServiceRequests.prototype, "request_status", void 0);
83
+ __decorate([
84
+ (0, typeorm_1.Column)({ type: 'timestamp', nullable: true }),
85
+ __metadata("design:type", Object)
86
+ ], ServiceRequests.prototype, "request_close_date", void 0);
87
+ __decorate([
88
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
89
+ __metadata("design:type", Object)
90
+ ], ServiceRequests.prototype, "remarks", void 0);
91
+ __decorate([
92
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
93
+ __metadata("design:type", Object)
94
+ ], ServiceRequests.prototype, "current_approval_level", void 0);
95
+ __decorate([
96
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
97
+ __metadata("design:type", Object)
98
+ ], ServiceRequests.prototype, "current_approver_id", void 0);
99
+ __decorate([
100
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
101
+ __metadata("design:type", Object)
102
+ ], ServiceRequests.prototype, "service_id", void 0);
103
+ __decorate([
104
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
105
+ __metadata("design:type", Object)
106
+ ], ServiceRequests.prototype, "sub_service_id", void 0);
107
+ __decorate([
108
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
109
+ __metadata("design:type", Object)
110
+ ], ServiceRequests.prototype, "section_id", void 0);
111
+ __decorate([
112
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
113
+ __metadata("design:type", Object)
114
+ ], ServiceRequests.prototype, "reporting_manager", void 0);
115
+ __decorate([
116
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
117
+ __metadata("design:type", Object)
118
+ ], ServiceRequests.prototype, "workflow_execution_id", void 0);
119
+ __decorate([
120
+ (0, typeorm_1.OneToMany)('ServiceChats', 'serviceRequest'),
121
+ __metadata("design:type", Array)
122
+ ], ServiceRequests.prototype, "chats", void 0);
123
+ __decorate([
124
+ (0, typeorm_1.OneToMany)('ServiceApprovals', 'serviceRequest'),
125
+ __metadata("design:type", Array)
126
+ ], ServiceRequests.prototype, "approvals", void 0);
127
+ __decorate([
128
+ (0, typeorm_1.OneToMany)('ServiceWorkFlow', 'serviceRequest'),
129
+ __metadata("design:type", Array)
130
+ ], ServiceRequests.prototype, "workflows", void 0);
131
+ __decorate([
132
+ (0, typeorm_1.OneToMany)('ServiceAttachments', 'serviceRequest'),
133
+ __metadata("design:type", Array)
134
+ ], ServiceRequests.prototype, "attachments", void 0);
135
+ exports.ServiceRequests = ServiceRequests = __decorate([
136
+ (0, typeorm_1.Entity)({ name: 'service_requests' }),
137
+ __metadata("design:paramtypes", [Number, String, String, String, String, Object, Object, Object, Object])
138
+ ], ServiceRequests);
@@ -0,0 +1,19 @@
1
+ import { BaseModel } from './BaseModel';
2
+ import { ServiceRequests } from './ServiceRequestsModel';
3
+ export declare enum ServiceWorkFlowStatus {
4
+ COMPLETED = "Completed",
5
+ NOT_YET_STARTED = "Not Yet Started",
6
+ PENDING = "Pending",
7
+ IN_PROGRESS = "In Progress",
8
+ FAILED = "Failed"
9
+ }
10
+ export declare class ServiceWorkFlow extends BaseModel {
11
+ service_request_id: number;
12
+ service_approval_id: number;
13
+ status: ServiceWorkFlowStatus;
14
+ approved_by_user_id: number;
15
+ content: string;
16
+ activity_date: Date;
17
+ serviceRequest?: ServiceRequests;
18
+ constructor(service_request_id: number, status: ServiceWorkFlowStatus, approved_by_user_id: number, content: string);
19
+ }
@@ -0,0 +1,68 @@
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.ServiceWorkFlow = exports.ServiceWorkFlowStatus = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ const ServiceRequestsModel_1 = require("./ServiceRequestsModel");
16
+ var ServiceWorkFlowStatus;
17
+ (function (ServiceWorkFlowStatus) {
18
+ ServiceWorkFlowStatus["COMPLETED"] = "Completed";
19
+ ServiceWorkFlowStatus["NOT_YET_STARTED"] = "Not Yet Started";
20
+ ServiceWorkFlowStatus["PENDING"] = "Pending";
21
+ ServiceWorkFlowStatus["IN_PROGRESS"] = "In Progress";
22
+ ServiceWorkFlowStatus["FAILED"] = "Failed";
23
+ })(ServiceWorkFlowStatus || (exports.ServiceWorkFlowStatus = ServiceWorkFlowStatus = {}));
24
+ let ServiceWorkFlow = class ServiceWorkFlow extends BaseModel_1.BaseModel {
25
+ constructor(service_request_id, status, approved_by_user_id, content) {
26
+ super();
27
+ this.service_request_id = service_request_id;
28
+ this.status = status;
29
+ this.approved_by_user_id = approved_by_user_id;
30
+ this.content = content;
31
+ this.service_approval_id = 0;
32
+ this.activity_date = new Date();
33
+ }
34
+ };
35
+ exports.ServiceWorkFlow = ServiceWorkFlow;
36
+ __decorate([
37
+ (0, typeorm_1.Column)({ type: 'int' }),
38
+ __metadata("design:type", Number)
39
+ ], ServiceWorkFlow.prototype, "service_request_id", void 0);
40
+ __decorate([
41
+ (0, typeorm_1.Column)({ type: 'int', nullable: true, default: 0 }),
42
+ __metadata("design:type", Number)
43
+ ], ServiceWorkFlow.prototype, "service_approval_id", void 0);
44
+ __decorate([
45
+ (0, typeorm_1.Column)({ type: 'enum', enum: ServiceWorkFlowStatus, default: ServiceWorkFlowStatus.NOT_YET_STARTED }),
46
+ __metadata("design:type", String)
47
+ ], ServiceWorkFlow.prototype, "status", void 0);
48
+ __decorate([
49
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
50
+ __metadata("design:type", Number)
51
+ ], ServiceWorkFlow.prototype, "approved_by_user_id", void 0);
52
+ __decorate([
53
+ (0, typeorm_1.Column)({ type: 'varchar', length: 500 }),
54
+ __metadata("design:type", String)
55
+ ], ServiceWorkFlow.prototype, "content", void 0);
56
+ __decorate([
57
+ (0, typeorm_1.Column)({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }),
58
+ __metadata("design:type", Date)
59
+ ], ServiceWorkFlow.prototype, "activity_date", void 0);
60
+ __decorate([
61
+ (0, typeorm_1.ManyToOne)(() => ServiceRequestsModel_1.ServiceRequests, sr => sr.workflows),
62
+ (0, typeorm_1.JoinColumn)({ name: 'service_request_id' }),
63
+ __metadata("design:type", ServiceRequestsModel_1.ServiceRequests)
64
+ ], ServiceWorkFlow.prototype, "serviceRequest", void 0);
65
+ exports.ServiceWorkFlow = ServiceWorkFlow = __decorate([
66
+ (0, typeorm_1.Entity)({ name: 'service_work_flows' }),
67
+ __metadata("design:paramtypes", [Number, String, Number, String])
68
+ ], ServiceWorkFlow);
@@ -1,7 +1,10 @@
1
1
  import { BaseModel } from './BaseModel';
2
+ import { TaskType } from "./WorkflowTaskNames";
3
+ import { CategoryType } from "./WorkflowTaskNames";
2
4
  export declare class WorkflowTask extends BaseModel {
3
5
  task_id: number;
4
6
  name: string;
5
- task_type: string;
6
- constructor(name: string, task_id?: number, task_type?: string);
7
+ task_type: TaskType;
8
+ category: CategoryType;
9
+ constructor(name: string, task_id?: number, task_type?: TaskType, category?: CategoryType);
7
10
  }
@@ -12,12 +12,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.WorkflowTask = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
14
  const BaseModel_1 = require("./BaseModel");
15
+ const WorkflowTaskNames_1 = require("./WorkflowTaskNames");
16
+ const WorkflowTaskNames_2 = require("./WorkflowTaskNames");
17
+ // export enum TaskNameType {
18
+ // SIMPLE = 'SIMPLE',
19
+ // HUMAN = 'HUMAN'
20
+ // }
21
+ // export enum CategoryNameType {
22
+ // CREATE = 'CREATE',
23
+ // APPROVAL = 'APPROVAL',
24
+ // NOTIFICATION = 'NOTIFICATION'
25
+ // }
15
26
  let WorkflowTask = class WorkflowTask extends BaseModel_1.BaseModel {
16
- constructor(name, task_id, task_type) {
27
+ constructor(name, task_id, task_type, category) {
17
28
  super();
18
29
  this.name = name;
19
30
  this.task_id = task_id || 0;
20
- this.task_type = task_type || '';
31
+ this.task_type = task_type || WorkflowTaskNames_1.TaskType.SIMPLE;
32
+ this.category = category || WorkflowTaskNames_2.CategoryType.CREATE;
21
33
  }
22
34
  };
23
35
  exports.WorkflowTask = WorkflowTask;
@@ -30,10 +42,22 @@ __decorate([
30
42
  __metadata("design:type", String)
31
43
  ], WorkflowTask.prototype, "name", void 0);
32
44
  __decorate([
33
- (0, typeorm_1.Column)({ type: 'varchar', length: 200, nullable: true }),
45
+ (0, typeorm_1.Column)({
46
+ type: 'enum',
47
+ enum: WorkflowTaskNames_1.TaskType,
48
+ nullable: true
49
+ }),
34
50
  __metadata("design:type", String)
35
51
  ], WorkflowTask.prototype, "task_type", void 0);
52
+ __decorate([
53
+ (0, typeorm_1.Column)({
54
+ type: 'enum',
55
+ enum: WorkflowTaskNames_2.CategoryType,
56
+ nullable: true
57
+ }),
58
+ __metadata("design:type", String)
59
+ ], WorkflowTask.prototype, "category", void 0);
36
60
  exports.WorkflowTask = WorkflowTask = __decorate([
37
61
  (0, typeorm_1.Entity)({ name: 'workflow_tasks' }),
38
- __metadata("design:paramtypes", [String, Number, String])
62
+ __metadata("design:paramtypes", [String, Number, String, String])
39
63
  ], WorkflowTask);
@@ -1,8 +1,17 @@
1
1
  import { BaseModel } from './BaseModel';
2
+ export declare enum TaskType {
3
+ SIMPLE = "SIMPLE",
4
+ HUMAN = "HUMAN"
5
+ }
6
+ export declare enum CategoryType {
7
+ CREATE = "CREATE",
8
+ APPROVAL = "APPROVAL",
9
+ NOTIFICATION = "NOTIFICATION"
10
+ }
2
11
  export declare class WorkflowTaskNames extends BaseModel {
3
12
  name: string;
4
- task_id: number;
5
13
  description: string;
6
- task_type: string;
7
- constructor(name: string, task_id: number, description: string, task_type: string);
14
+ task_type: TaskType;
15
+ category: CategoryType;
16
+ constructor(name: string, description: string, task_type: TaskType, category: CategoryType);
8
17
  }
@@ -9,16 +9,27 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.WorkflowTaskNames = void 0;
12
+ exports.WorkflowTaskNames = exports.CategoryType = exports.TaskType = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
14
  const BaseModel_1 = require("./BaseModel");
15
+ var TaskType;
16
+ (function (TaskType) {
17
+ TaskType["SIMPLE"] = "SIMPLE";
18
+ TaskType["HUMAN"] = "HUMAN";
19
+ })(TaskType || (exports.TaskType = TaskType = {}));
20
+ var CategoryType;
21
+ (function (CategoryType) {
22
+ CategoryType["CREATE"] = "CREATE";
23
+ CategoryType["APPROVAL"] = "APPROVAL";
24
+ CategoryType["NOTIFICATION"] = "NOTIFICATION";
25
+ })(CategoryType || (exports.CategoryType = CategoryType = {}));
15
26
  let WorkflowTaskNames = class WorkflowTaskNames extends BaseModel_1.BaseModel {
16
- constructor(name, task_id, description, task_type) {
27
+ constructor(name, description, task_type, category) {
17
28
  super();
18
29
  this.name = name;
19
- this.task_id = task_id;
20
30
  this.description = description;
21
31
  this.task_type = task_type;
32
+ this.category = category;
22
33
  }
23
34
  };
24
35
  exports.WorkflowTaskNames = WorkflowTaskNames;
@@ -26,19 +37,27 @@ __decorate([
26
37
  (0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: false }),
27
38
  __metadata("design:type", String)
28
39
  ], WorkflowTaskNames.prototype, "name", void 0);
29
- __decorate([
30
- (0, typeorm_1.Column)({ type: 'integer', nullable: false }),
31
- __metadata("design:type", Number)
32
- ], WorkflowTaskNames.prototype, "task_id", void 0);
33
40
  __decorate([
34
41
  (0, typeorm_1.Column)({ type: 'varchar', length: 200, nullable: true }),
35
42
  __metadata("design:type", String)
36
43
  ], WorkflowTaskNames.prototype, "description", void 0);
37
44
  __decorate([
38
- (0, typeorm_1.Column)({ type: 'varchar', length: 200, nullable: true }),
45
+ (0, typeorm_1.Column)({
46
+ type: 'enum',
47
+ enum: TaskType,
48
+ nullable: true
49
+ }),
39
50
  __metadata("design:type", String)
40
51
  ], WorkflowTaskNames.prototype, "task_type", void 0);
52
+ __decorate([
53
+ (0, typeorm_1.Column)({
54
+ type: 'enum',
55
+ enum: CategoryType,
56
+ nullable: true
57
+ }),
58
+ __metadata("design:type", String)
59
+ ], WorkflowTaskNames.prototype, "category", void 0);
41
60
  exports.WorkflowTaskNames = WorkflowTaskNames = __decorate([
42
61
  (0, typeorm_1.Entity)({ name: 'workflow_task_names' }),
43
- __metadata("design:paramtypes", [String, Number, String, String])
62
+ __metadata("design:paramtypes", [String, String, String, String])
44
63
  ], WorkflowTaskNames);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platform-modules/foreign-ministry",
3
- "version": "1.1.9",
3
+ "version": "1.1.12",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -80,6 +80,11 @@ import { StayAfterHoursApprovalDetails } from './models/StayAfterHoursApprovalMo
80
80
  import { StayAfterHoursRequestAttachment } from './models/StayAfterHoursAttachmentModel';
81
81
  import { StayAfterHoursRequestChat } from './models/StayAfterHoursChatModel';
82
82
  import { StayAfterHoursWorkFlow } from './models/StayAfterHoursWorkflowModel';
83
+ import { ServiceRequests } from './models/ServiceRequestsModel';
84
+ import { ServiceApprovals } from './models/ServiceApprovalsModel';
85
+ import { ServiceWorkFlow } from './models/ServiceWorkFlowModel';
86
+ import { ServiceAttachments } from './models/ServiceAttachmentsModel';
87
+ import { ServiceChats } from './models/ServiceChatsModel';
83
88
 
84
89
 
85
90
  import { WorkflowTask } from './models/WorkflowTask';
@@ -179,5 +184,10 @@ export const AppDataSource = new DataSource({
179
184
  ,StayAfterHoursRequestAttachment
180
185
  ,StayAfterHoursRequestChat
181
186
  ,StayAfterHoursWorkFlow
187
+ ,ServiceRequests
188
+ ,ServiceApprovals
189
+ ,ServiceWorkFlow
190
+ ,ServiceAttachments
191
+ ,ServiceChats
182
192
  ],
183
193
  });
package/src/index.ts CHANGED
@@ -77,3 +77,8 @@ export * from './models/StayAfterHoursApprovalModel';
77
77
  export * from './models/StayAfterHoursAttachmentModel';
78
78
  export * from './models/StayAfterHoursChatModel';
79
79
  export * from './models/StayAfterHoursWorkflowModel';
80
+ export * from './models/ServiceRequestsModel';
81
+ export * from './models/ServiceApprovalsModel';
82
+ export * from './models/ServiceWorkFlowModel';
83
+ export * from './models/ServiceAttachmentsModel';
84
+ export * from './models/ServiceChatsModel';
@@ -0,0 +1,68 @@
1
+ import { Column, Entity, ManyToOne, JoinColumn } from "typeorm";
2
+ import { BaseModel } from './BaseModel';
3
+ import { ServiceRequests } from './ServiceRequestsModel';
4
+
5
+ export enum ServiceApprovalStatus {
6
+ PENDING = "Pending",
7
+ APPROVED = "Approved",
8
+ REJECTED = "Rejected",
9
+ SKIPPED = "Skipped",
10
+ IN_PROGRESS = "In Progress"
11
+ }
12
+
13
+ @Entity({ name: 'service_approvals' })
14
+ export class ServiceApprovals extends BaseModel {
15
+ @Column({ type: 'int' })
16
+ service_request_id: number;
17
+
18
+ @Column({ type: 'int' })
19
+ level: number;
20
+
21
+ @Column({ type: 'int', nullable: true })
22
+ approver_user_id: number | null;
23
+
24
+ @Column({ type: 'int' })
25
+ approver_role_id: number;
26
+
27
+ @Column({ type: 'text', nullable: true })
28
+ comment: string | null;
29
+
30
+ @Column({ type: 'enum', enum: ServiceApprovalStatus, default: ServiceApprovalStatus.PENDING })
31
+ approval_status: ServiceApprovalStatus;
32
+
33
+ @Column({ type: 'timestamp', nullable: true })
34
+ action_date: Date;
35
+
36
+ @Column({ type: 'int', nullable: true })
37
+ department_id: number | null;
38
+
39
+ @Column({ type: 'int', nullable: true })
40
+ section_id: number | null;
41
+
42
+ @Column({ type: 'int', nullable: true })
43
+ approved_by: number | null;
44
+
45
+ @ManyToOne(() => ServiceRequests, sr => sr.approvals)
46
+ @JoinColumn({ name: 'service_request_id' })
47
+ serviceRequest?: ServiceRequests;
48
+
49
+ constructor(
50
+ service_request_id: number,
51
+ level: number,
52
+ approver_role_id: number,
53
+ approval_status: ServiceApprovalStatus,
54
+ department_id: number | null,
55
+ section_id: number | null,
56
+ approved_by: number | null
57
+ ) {
58
+ super();
59
+ this.service_request_id = service_request_id;
60
+ this.level = level;
61
+ this.approver_role_id = approver_role_id;
62
+ this.approval_status = approval_status;
63
+ this.department_id = department_id;
64
+ this.section_id = section_id;
65
+ this.approved_by = approved_by;
66
+ }
67
+ }
68
+
@@ -0,0 +1,35 @@
1
+ import { Column, Entity, ManyToOne, JoinColumn } from "typeorm";
2
+ import { BaseModel } from './BaseModel';
3
+ import { ServiceRequests } from './ServiceRequestsModel';
4
+
5
+ @Entity({ name: 'service_attachments' })
6
+ export class ServiceAttachments extends BaseModel {
7
+ @Column({ type: 'int' })
8
+ service_request_id: number;
9
+
10
+ @Column({ type: 'varchar', length: 500 })
11
+ file_url: string;
12
+
13
+ @Column({ type: 'varchar', length: 255 })
14
+ file_name: string;
15
+
16
+ @Column({ type: 'varchar', length: 50, nullable: true })
17
+ file_type: string; // PDF, JPG, PNG, etc.
18
+
19
+ @ManyToOne(() => ServiceRequests, sr => sr.attachments)
20
+ @JoinColumn({ name: 'service_request_id' })
21
+ serviceRequest?: ServiceRequests;
22
+
23
+ constructor(
24
+ service_request_id: number,
25
+ file_url: string,
26
+ file_name: string
27
+ ) {
28
+ super();
29
+ this.service_request_id = service_request_id;
30
+ this.file_url = file_url;
31
+ this.file_name = file_name;
32
+ this.file_type = 'PDF';
33
+ }
34
+ }
35
+
@@ -0,0 +1,27 @@
1
+ import { Column, Entity, ManyToOne, JoinColumn } from "typeorm";
2
+ import { BaseModel } from './BaseModel';
3
+ import { ServiceRequests } from './ServiceRequestsModel';
4
+
5
+ @Entity({ name: 'service_chats' })
6
+ export class ServiceChats extends BaseModel {
7
+ @Column({ type: 'int' })
8
+ service_request_id: number;
9
+
10
+ @Column({ type: 'text' })
11
+ content: string;
12
+
13
+ @Column({ type: 'int' })
14
+ sender_user_id: number;
15
+
16
+ @ManyToOne(() => ServiceRequests, sr => sr.chats)
17
+ @JoinColumn({ name: 'service_request_id' })
18
+ serviceRequest?: ServiceRequests;
19
+
20
+ constructor(service_request_id: number, content: string, sender_user_id: number) {
21
+ super();
22
+ this.service_request_id = service_request_id;
23
+ this.content = content;
24
+ this.sender_user_id = sender_user_id;
25
+ }
26
+ }
27
+
@@ -0,0 +1,117 @@
1
+ import { Column, Entity, OneToMany, ManyToOne, JoinColumn } from "typeorm";
2
+ import { BaseModel } from './BaseModel';
3
+
4
+ // Import types only (not for runtime)
5
+ import type { ServiceChats } from './ServiceChatsModel';
6
+ import type { ServiceApprovals } from './ServiceApprovalsModel';
7
+ import type { ServiceWorkFlow } from './ServiceWorkFlowModel';
8
+ import type { ServiceAttachments } from './ServiceAttachmentsModel';
9
+
10
+ export enum ServiceRequestStatus {
11
+ DRAFT = "Draft",
12
+ SUBMITTED = "Submitted",
13
+ PENDING = "Pending",
14
+ IN_PROGRESS = "In Progress",
15
+ APPROVED = "Approved",
16
+ REJECTED = "Rejected",
17
+ COMPLETED = "Completed",
18
+ CANCELLED = "Cancelled"
19
+ }
20
+
21
+ @Entity({ name: 'service_requests' })
22
+ export class ServiceRequests extends BaseModel {
23
+ @Column({ type: 'int' })
24
+ user_id: number;
25
+
26
+ @Column({ type: 'varchar', length: 100 })
27
+ employee_id: string;
28
+
29
+ @Column({ type: 'varchar', length: 255 })
30
+ employee_name: string;
31
+
32
+ @Column({ type: 'varchar', length: 100, nullable: true })
33
+ grade: string | null;
34
+
35
+ @Column({ type: 'int', nullable: true })
36
+ designation_id: number | null;
37
+
38
+ @Column({ type: 'int', nullable: true })
39
+ department_id: number | null;
40
+
41
+ @Column({ type: 'varchar', length: 255 })
42
+ email_address: string;
43
+
44
+ @Column({ type: 'varchar', length: 20 })
45
+ contact_number: string;
46
+
47
+ @Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
48
+ request_date: Date;
49
+
50
+ @Column({ type: 'enum', enum: ServiceRequestStatus, default: ServiceRequestStatus.PENDING })
51
+ request_status: ServiceRequestStatus;
52
+
53
+ @Column({ type: 'timestamp', nullable: true })
54
+ request_close_date: Date | null;
55
+
56
+ @Column({ type: 'text', nullable: true })
57
+ remarks: string | null;
58
+
59
+ @Column({ type: 'int', nullable: true })
60
+ current_approval_level: number | null;
61
+
62
+ @Column({ type: 'int', nullable: true })
63
+ current_approver_id: number | null;
64
+
65
+ @Column({ type: 'int', nullable: true })
66
+ service_id: number | null;
67
+
68
+ @Column({ type: 'int', nullable: true })
69
+ sub_service_id: number | null;
70
+
71
+ @Column({ type: 'int', nullable: true })
72
+ section_id: number | null;
73
+
74
+ @Column({ type: 'int', nullable: true })
75
+ reporting_manager: number | null;
76
+
77
+ @Column({ type: 'varchar', length: 255, nullable: true })
78
+ workflow_execution_id: string | null;
79
+
80
+ @OneToMany('ServiceChats', 'serviceRequest')
81
+ chats?: ServiceChats[];
82
+
83
+ @OneToMany('ServiceApprovals', 'serviceRequest')
84
+ approvals?: ServiceApprovals[];
85
+
86
+ @OneToMany('ServiceWorkFlow', 'serviceRequest')
87
+ workflows?: ServiceWorkFlow[];
88
+
89
+ @OneToMany('ServiceAttachments', 'serviceRequest')
90
+ attachments?: ServiceAttachments[];
91
+
92
+ constructor(
93
+ user_id: number,
94
+ employee_id: string,
95
+ employee_name: string,
96
+ email_address: string,
97
+ contact_number: string,
98
+ service_id: number | null,
99
+ sub_service_id: number | null,
100
+ section_id: number | null,
101
+ reporting_manager: number | null
102
+ ) {
103
+ super();
104
+ this.user_id = user_id;
105
+ this.employee_id = employee_id;
106
+ this.employee_name = employee_name;
107
+ this.email_address = email_address;
108
+ this.contact_number = contact_number;
109
+ this.request_date = new Date();
110
+ this.request_status = ServiceRequestStatus.PENDING;
111
+ this.service_id = service_id;
112
+ this.sub_service_id = sub_service_id;
113
+ this.section_id = section_id;
114
+ this.reporting_manager = reporting_manager;
115
+ }
116
+ }
117
+
@@ -0,0 +1,52 @@
1
+ import { Column, Entity, ManyToOne, JoinColumn } from "typeorm";
2
+ import { BaseModel } from './BaseModel';
3
+ import { ServiceRequests } from './ServiceRequestsModel';
4
+
5
+ export enum ServiceWorkFlowStatus {
6
+ COMPLETED = "Completed",
7
+ NOT_YET_STARTED = "Not Yet Started",
8
+ PENDING = "Pending",
9
+ IN_PROGRESS = "In Progress",
10
+ FAILED = "Failed"
11
+ }
12
+
13
+ @Entity({ name: 'service_work_flows' })
14
+ export class ServiceWorkFlow extends BaseModel {
15
+ @Column({ type: 'int' })
16
+ service_request_id: number;
17
+
18
+ @Column({ type: 'int', nullable: true, default: 0 })
19
+ service_approval_id: number;
20
+
21
+ @Column({ type: 'enum', enum: ServiceWorkFlowStatus, default: ServiceWorkFlowStatus.NOT_YET_STARTED })
22
+ status: ServiceWorkFlowStatus;
23
+
24
+ @Column({ type: 'int', nullable: true })
25
+ approved_by_user_id: number;
26
+
27
+ @Column({ type: 'varchar', length: 500 })
28
+ content: string;
29
+
30
+ @Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
31
+ activity_date: Date;
32
+
33
+ @ManyToOne(() => ServiceRequests, sr => sr.workflows)
34
+ @JoinColumn({ name: 'service_request_id' })
35
+ serviceRequest?: ServiceRequests;
36
+
37
+ constructor(
38
+ service_request_id: number,
39
+ status: ServiceWorkFlowStatus,
40
+ approved_by_user_id: number,
41
+ content: string
42
+ ) {
43
+ super();
44
+ this.service_request_id = service_request_id;
45
+ this.status = status;
46
+ this.approved_by_user_id = approved_by_user_id;
47
+ this.content = content;
48
+ this.service_approval_id = 0;
49
+ this.activity_date = new Date();
50
+ }
51
+ }
52
+
@@ -1,5 +1,19 @@
1
1
  import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
2
2
  import { BaseModel } from './BaseModel';
3
+ import { TaskType } from "./WorkflowTaskNames";
4
+ import { CategoryType } from "./WorkflowTaskNames";
5
+
6
+
7
+ // export enum TaskNameType {
8
+ // SIMPLE = 'SIMPLE',
9
+ // HUMAN = 'HUMAN'
10
+ // }
11
+
12
+ // export enum CategoryNameType {
13
+ // CREATE = 'CREATE',
14
+ // APPROVAL = 'APPROVAL',
15
+ // NOTIFICATION = 'NOTIFICATION'
16
+ // }
3
17
 
4
18
  @Entity({ name: 'workflow_tasks' })
5
19
  export class WorkflowTask extends BaseModel {
@@ -10,17 +24,30 @@ export class WorkflowTask extends BaseModel {
10
24
  @Column({ type: 'varchar', length: 100, nullable: false })
11
25
  name: string;
12
26
 
13
- @Column({ type: 'varchar', length: 200, nullable: true })
14
- task_type: string;
27
+ @Column({
28
+ type: 'enum',
29
+ enum: TaskType,
30
+ nullable: true
31
+ })
32
+ task_type: TaskType;
33
+
34
+ @Column({
35
+ type: 'enum',
36
+ enum: CategoryType,
37
+ nullable: true
38
+ })
39
+ category: CategoryType;
15
40
 
16
41
  constructor(
17
42
  name: string,
18
43
  task_id?: number,
19
- task_type?: string
44
+ task_type?: TaskType,
45
+ category?: CategoryType
20
46
  ) {
21
47
  super();
22
48
  this.name = name;
23
49
  this.task_id = task_id || 0;
24
- this.task_type = task_type || '';
50
+ this.task_type = task_type || TaskType.SIMPLE;
51
+ this.category = category || CategoryType.CREATE;
25
52
  }
26
53
  }
@@ -1,31 +1,50 @@
1
1
  import { Column, Entity } from "typeorm";
2
2
  import { BaseModel } from './BaseModel';
3
3
 
4
+ export enum TaskType {
5
+ SIMPLE = 'SIMPLE',
6
+ HUMAN = 'HUMAN'
7
+ }
8
+
9
+ export enum CategoryType {
10
+ CREATE = 'CREATE',
11
+ APPROVAL = 'APPROVAL',
12
+ NOTIFICATION = 'NOTIFICATION'
13
+ }
14
+
4
15
  @Entity({ name: 'workflow_task_names' })
5
16
  export class WorkflowTaskNames extends BaseModel {
6
17
 
7
18
  @Column({ type: 'varchar', length: 100, nullable: false })
8
19
  name: string;
9
-
10
- @Column({ type: 'integer', nullable: false })
11
- task_id: number;
12
20
 
13
21
  @Column({ type: 'varchar', length: 200, nullable: true })
14
22
  description: string;
15
23
 
16
- @Column({ type: 'varchar', length: 200, nullable: true })
17
- task_type: string;
24
+ @Column({
25
+ type: 'enum',
26
+ enum: TaskType,
27
+ nullable: true
28
+ })
29
+ task_type: TaskType;
30
+
31
+ @Column({
32
+ type: 'enum',
33
+ enum: CategoryType,
34
+ nullable: true
35
+ })
36
+ category: CategoryType;
18
37
 
19
38
  constructor(
20
39
  name: string,
21
- task_id: number,
22
40
  description: string,
23
- task_type: string
41
+ task_type: TaskType,
42
+ category: CategoryType
24
43
  ) {
25
44
  super();
26
45
  this.name = name;
27
- this.task_id = task_id;
28
46
  this.description = description;
29
47
  this.task_type = task_type;
48
+ this.category = category;
30
49
  }
31
50
  }
@@ -1,13 +0,0 @@
1
- import { BaseModel } from './BaseModel';
2
- export declare enum ApprovalStatus {
3
- PENDING = "Pending",
4
- APPROVED = "Approved",
5
- REJECTED = "Rejected"
6
- }
7
- export declare class LeaveApprovalDetails extends BaseModel {
8
- leave_request_id: number;
9
- level: number;
10
- approver_id: number;
11
- approval_status: ApprovalStatus;
12
- constructor(leave_request_id: number, approver_id: number, approval_status: ApprovalStatus, level: number);
13
- }
@@ -1,51 +0,0 @@
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.LeaveApprovalDetails = exports.ApprovalStatus = void 0;
13
- const typeorm_1 = require("typeorm");
14
- const BaseModel_1 = require("./BaseModel");
15
- var ApprovalStatus;
16
- (function (ApprovalStatus) {
17
- ApprovalStatus["PENDING"] = "Pending";
18
- ApprovalStatus["APPROVED"] = "Approved";
19
- ApprovalStatus["REJECTED"] = "Rejected";
20
- })(ApprovalStatus || (exports.ApprovalStatus = ApprovalStatus = {}));
21
- //This model is used to store the store the leave apporval details of the user for the leave request
22
- let LeaveApprovalDetails = class LeaveApprovalDetails extends BaseModel_1.BaseModel {
23
- constructor(leave_request_id, approver_id, approval_status, level) {
24
- super();
25
- this.leave_request_id = leave_request_id;
26
- this.approver_id = approver_id;
27
- this.approval_status = approval_status;
28
- this.level = level;
29
- }
30
- };
31
- exports.LeaveApprovalDetails = LeaveApprovalDetails;
32
- __decorate([
33
- (0, typeorm_1.Column)({ type: 'int', nullable: false }),
34
- __metadata("design:type", Number)
35
- ], LeaveApprovalDetails.prototype, "leave_request_id", void 0);
36
- __decorate([
37
- (0, typeorm_1.Column)({ type: 'int', nullable: false }),
38
- __metadata("design:type", Number)
39
- ], LeaveApprovalDetails.prototype, "level", void 0);
40
- __decorate([
41
- (0, typeorm_1.Column)({ type: 'int', nullable: false }),
42
- __metadata("design:type", Number)
43
- ], LeaveApprovalDetails.prototype, "approver_id", void 0);
44
- __decorate([
45
- (0, typeorm_1.Column)({ type: 'enum', enum: ApprovalStatus, default: ApprovalStatus.PENDING, nullable: false }),
46
- __metadata("design:type", String)
47
- ], LeaveApprovalDetails.prototype, "approval_status", void 0);
48
- exports.LeaveApprovalDetails = LeaveApprovalDetails = __decorate([
49
- (0, typeorm_1.Entity)({ name: 'leave_approval_details' }),
50
- __metadata("design:paramtypes", [Number, Number, String, Number])
51
- ], LeaveApprovalDetails);
@@ -1,7 +0,0 @@
1
- import { BaseModel } from './BaseModel';
2
- export declare class LeaveApprovalMatrix extends BaseModel {
3
- leave_type: number;
4
- level: number;
5
- approval_matrix: string;
6
- constructor(leave_type: number, level: number, approval_matrix: string);
7
- }
@@ -1,40 +0,0 @@
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.LeaveApprovalMatrix = void 0;
13
- const typeorm_1 = require("typeorm");
14
- const BaseModel_1 = require("./BaseModel");
15
- //This model is used to store the store the leave apporval matrix(HOD, Manager, HR, Director) based on leave type along with the levels
16
- let LeaveApprovalMatrix = class LeaveApprovalMatrix extends BaseModel_1.BaseModel {
17
- constructor(leave_type, level, approval_matrix) {
18
- super();
19
- this.leave_type = leave_type;
20
- this.level = level;
21
- this.approval_matrix = approval_matrix;
22
- }
23
- };
24
- exports.LeaveApprovalMatrix = LeaveApprovalMatrix;
25
- __decorate([
26
- (0, typeorm_1.Column)({ type: 'int', nullable: false }),
27
- __metadata("design:type", Number)
28
- ], LeaveApprovalMatrix.prototype, "leave_type", void 0);
29
- __decorate([
30
- (0, typeorm_1.Column)({ type: 'int', nullable: false }),
31
- __metadata("design:type", Number)
32
- ], LeaveApprovalMatrix.prototype, "level", void 0);
33
- __decorate([
34
- (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: false }),
35
- __metadata("design:type", String)
36
- ], LeaveApprovalMatrix.prototype, "approval_matrix", void 0);
37
- exports.LeaveApprovalMatrix = LeaveApprovalMatrix = __decorate([
38
- (0, typeorm_1.Entity)({ name: 'leave_approval_matrix' }),
39
- __metadata("design:paramtypes", [Number, Number, String])
40
- ], LeaveApprovalMatrix);