@platform-modules/civil-aviation-authority 2.3.251 → 2.3.256
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +15 -0
- package/dist/data-source.js +8 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/models/DocumentMetadataModel.d.ts +45 -0
- package/dist/models/DocumentMetadataModel.js +171 -0
- package/dist/models/DocumentationDepartmentsModel.d.ts +13 -0
- package/dist/models/DocumentationDepartmentsModel.js +53 -0
- package/dist/models/FolderModel.d.ts +16 -0
- package/dist/models/FolderModel.js +85 -0
- package/dist/models/ImportExportMaterialModels.d.ts +92 -0
- package/dist/models/ImportExportMaterialModels.js +307 -0
- package/dist/models/PermissionModel.d.ts +18 -0
- package/dist/models/PermissionModel.js +68 -0
- package/dist/models/SecurityAccessApprovalModel.d.ts +23 -0
- package/dist/models/SecurityAccessApprovalModel.js +82 -0
- package/dist/models/SecurityAccessAttachmentModel.d.ts +12 -0
- package/dist/models/SecurityAccessAttachmentModel.js +56 -0
- package/dist/models/SecurityAccessChatModel.d.ts +12 -0
- package/dist/models/SecurityAccessChatModel.js +56 -0
- package/dist/models/SecurityAccessRequestModel.d.ts +25 -0
- package/dist/models/SecurityAccessRequestModel.js +80 -0
- package/dist/models/SecurityAccessWorkflowModel.d.ts +24 -0
- package/dist/models/SecurityAccessWorkflowModel.js +84 -0
- package/dist/models/ServiceExtensionAfterAge60Models.d.ts +93 -0
- package/dist/models/ServiceExtensionAfterAge60Models.js +312 -0
- package/dist/models/SlaMyRequestsViewModel.d.ts +25 -0
- package/dist/models/SlaMyRequestsViewModel.js +148 -0
- package/dist/models/UUIDBaseModel.d.ts +14 -0
- package/dist/models/UUIDBaseModel.js +66 -0
- package/dist/models/WorkingHoursExtensionModels.d.ts +88 -0
- package/dist/models/WorkingHoursExtensionModels.js +295 -0
- package/package.json +1 -1
- package/src/data-source.ts +8 -0
- package/src/index.ts +1 -0
- package/src/models/AccessCardRequestModel.ts +135 -135
- package/src/models/AirportEntryPermitModel.ts +276 -276
- package/src/models/AnnualTrainingPlanRequestModel.ts +153 -153
- package/src/models/DepartmentsModel.ts +25 -25
- package/src/models/DocumentDriveModel.ts +28 -28
- package/src/models/DocumentFolderModel.ts +45 -45
- package/src/models/HotelApprovalModel.ts +83 -83
- package/src/models/HousingContractCancelApprovalModel.ts +64 -64
- package/src/models/HousingContractCancelChatModel.ts +56 -56
- package/src/models/HousingContractRenewalApprovalModel.ts +64 -64
- package/src/models/HousingContractRenewalChatModel.ts +59 -59
- package/src/models/ITRequestAttachmentModel.ts +73 -73
- package/src/models/ITRequestChatModel.ts +74 -74
- package/src/models/ItApprovalsModel.ts +84 -84
- package/src/models/ItWorkflowModel.ts +55 -55
- package/src/models/LegalConsultationApprovalModel.ts +65 -65
- package/src/models/MissionTravelPassportExpiryNotificationConfigModel.ts +36 -36
- package/src/models/NotificationModel.ts +89 -89
- package/src/models/ResidentialUnitRentalApprovalModel.ts +143 -143
- package/src/models/ResidentialUnitRentalChatModel.ts +56 -56
- package/src/models/ResidentialUnitRentalRequestModel.ts +218 -218
- package/src/models/ServiceExtensionAfter60ApprovalModel.ts +87 -87
- package/src/models/ServiceSlaApprovalModel.ts +64 -64
- package/src/models/ServicesNotificationConfigModel.ts +55 -55
- package/src/models/SlaMyRequestsViewModel.ts +142 -0
- package/src/models/SlaRequestModel.ts +65 -65
- package/src/models/StudyLeaveRequestModel.ts +144 -144
- package/src/models/TrainingRequestModel.ts +164 -164
- package/src/models/TrainingRoomBookingRequestModel.ts +142 -142
- package/src/models/TrainingRoomNotificationConfigModel.ts +30 -30
- package/src/models/role.ts +34 -34
- package/src/models/user.ts +233 -233
- package/src/sla/sla-table-sync.service.ts +90 -90
- package/migrations/add_sla_approval_mirror_columns.sql +0 -11
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import { Column, Entity, Index } from "typeorm";
|
|
2
|
-
import { BaseModel } from "./BaseModel";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Cross-service SLA tracking row for any microservice (HR, IT, Tender, …).
|
|
6
|
-
* Segregated by service_id, sub_service_id, request_id.
|
|
7
|
-
* source_approval_id = native approval row PK in the owning service (e.g. hr_service_approvals.id, vpn_approvals.id); not a DB FK.
|
|
8
|
-
*/
|
|
9
|
-
@Entity({ name: "sla_approval" })
|
|
10
|
-
@Index("idx_sla_approval_request_id", ["request_id"])
|
|
11
|
-
@Index("idx_sla_approval_source_approval_id", ["source_approval_id"])
|
|
12
|
-
@Index("idx_sla_approval_service_subservice", ["service_id", "sub_service_id"])
|
|
13
|
-
@Index("idx_sla_approval_approval_status", ["approval_status"])
|
|
14
|
-
@Index("idx_sla_approval_level", ["level"])
|
|
15
|
-
@Index("idx_sla_approval_approver_user_id", ["approver_user_id"])
|
|
16
|
-
@Index("idx_sla_approval_request_level", ["request_id", "level"])
|
|
17
|
-
@Index("idx_sla_approval_svc_sub_status", ["service_id", "sub_service_id", "approval_status"])
|
|
18
|
-
export class ServiceSlaApproval extends BaseModel {
|
|
19
|
-
@Column({ type: "int" })
|
|
20
|
-
request_id: number;
|
|
21
|
-
|
|
22
|
-
@Column({ type: "int" })
|
|
23
|
-
source_approval_id: number;
|
|
24
|
-
|
|
25
|
-
@Column({ type: "int", nullable: true })
|
|
26
|
-
service_id: number | null;
|
|
27
|
-
|
|
28
|
-
@Column({ type: "int", nullable: true })
|
|
29
|
-
sub_service_id: number | null;
|
|
30
|
-
|
|
31
|
-
@Column({ type: "varchar", length: 64 })
|
|
32
|
-
approval_status: string;
|
|
33
|
-
|
|
34
|
-
@Column({ type: "int" })
|
|
35
|
-
level: number;
|
|
36
|
-
|
|
37
|
-
@Column({ type: "int", nullable: true })
|
|
38
|
-
approver_user_id: number | null;
|
|
39
|
-
|
|
40
|
-
@Column({ type: "int", nullable: true })
|
|
41
|
-
approver_role_id: number | null;
|
|
42
|
-
|
|
43
|
-
@Column({ type: "int", nullable: true })
|
|
44
|
-
department_id: number | null;
|
|
45
|
-
|
|
46
|
-
@Column({ type: "int", nullable: true })
|
|
47
|
-
section_id: number | null;
|
|
48
|
-
|
|
49
|
-
/** Mirrors native approval `delegate_user_id` (IT master tables may use `delegation_user_id`). */
|
|
50
|
-
@Column({ type: "int", nullable: true })
|
|
51
|
-
delegate_user_id: number | null;
|
|
52
|
-
|
|
53
|
-
/** Mirrors native approval `approved_by` (acting user when status was last resolved). */
|
|
54
|
-
@Column({ type: "int", nullable: true })
|
|
55
|
-
approved_by: number | null;
|
|
56
|
-
|
|
57
|
-
/** Mirrors native approval comment / rejection reason. */
|
|
58
|
-
@Column({ type: "varchar", length: 255, nullable: true })
|
|
59
|
-
comment: string | null;
|
|
60
|
-
|
|
61
|
-
constructor() {
|
|
62
|
-
super();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
1
|
+
import { Column, Entity, Index } from "typeorm";
|
|
2
|
+
import { BaseModel } from "./BaseModel";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Cross-service SLA tracking row for any microservice (HR, IT, Tender, …).
|
|
6
|
+
* Segregated by service_id, sub_service_id, request_id.
|
|
7
|
+
* source_approval_id = native approval row PK in the owning service (e.g. hr_service_approvals.id, vpn_approvals.id); not a DB FK.
|
|
8
|
+
*/
|
|
9
|
+
@Entity({ name: "sla_approval" })
|
|
10
|
+
@Index("idx_sla_approval_request_id", ["request_id"])
|
|
11
|
+
@Index("idx_sla_approval_source_approval_id", ["source_approval_id"])
|
|
12
|
+
@Index("idx_sla_approval_service_subservice", ["service_id", "sub_service_id"])
|
|
13
|
+
@Index("idx_sla_approval_approval_status", ["approval_status"])
|
|
14
|
+
@Index("idx_sla_approval_level", ["level"])
|
|
15
|
+
@Index("idx_sla_approval_approver_user_id", ["approver_user_id"])
|
|
16
|
+
@Index("idx_sla_approval_request_level", ["request_id", "level"])
|
|
17
|
+
@Index("idx_sla_approval_svc_sub_status", ["service_id", "sub_service_id", "approval_status"])
|
|
18
|
+
export class ServiceSlaApproval extends BaseModel {
|
|
19
|
+
@Column({ type: "int" })
|
|
20
|
+
request_id: number;
|
|
21
|
+
|
|
22
|
+
@Column({ type: "int" })
|
|
23
|
+
source_approval_id: number;
|
|
24
|
+
|
|
25
|
+
@Column({ type: "int", nullable: true })
|
|
26
|
+
service_id: number | null;
|
|
27
|
+
|
|
28
|
+
@Column({ type: "int", nullable: true })
|
|
29
|
+
sub_service_id: number | null;
|
|
30
|
+
|
|
31
|
+
@Column({ type: "varchar", length: 64 })
|
|
32
|
+
approval_status: string;
|
|
33
|
+
|
|
34
|
+
@Column({ type: "int" })
|
|
35
|
+
level: number;
|
|
36
|
+
|
|
37
|
+
@Column({ type: "int", nullable: true })
|
|
38
|
+
approver_user_id: number | null;
|
|
39
|
+
|
|
40
|
+
@Column({ type: "int", nullable: true })
|
|
41
|
+
approver_role_id: number | null;
|
|
42
|
+
|
|
43
|
+
@Column({ type: "int", nullable: true })
|
|
44
|
+
department_id: number | null;
|
|
45
|
+
|
|
46
|
+
@Column({ type: "int", nullable: true })
|
|
47
|
+
section_id: number | null;
|
|
48
|
+
|
|
49
|
+
/** Mirrors native approval `delegate_user_id` (IT master tables may use `delegation_user_id`). */
|
|
50
|
+
@Column({ type: "int", nullable: true })
|
|
51
|
+
delegate_user_id: number | null;
|
|
52
|
+
|
|
53
|
+
/** Mirrors native approval `approved_by` (acting user when status was last resolved). */
|
|
54
|
+
@Column({ type: "int", nullable: true })
|
|
55
|
+
approved_by: number | null;
|
|
56
|
+
|
|
57
|
+
/** Mirrors native approval comment / rejection reason. */
|
|
58
|
+
@Column({ type: "varchar", length: 255, nullable: true })
|
|
59
|
+
comment: string | null;
|
|
60
|
+
|
|
61
|
+
constructor() {
|
|
62
|
+
super();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { Column, Entity } from "typeorm";
|
|
2
|
-
import { BaseModel } from "./BaseModel";
|
|
3
|
-
|
|
4
|
-
export enum ServicesNotificationTriggerType {
|
|
5
|
-
FINAL_APPROVAL = "final_approval",
|
|
6
|
-
EVERY_APPROVAL = "every_approval"
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
@Entity({ name: "services_notification_configs" })
|
|
10
|
-
export class ServicesNotificationConfigs extends BaseModel {
|
|
11
|
-
@Column({ type: "integer", nullable: false })
|
|
12
|
-
service_id: number;
|
|
13
|
-
|
|
14
|
-
@Column({ type: "integer", nullable: false })
|
|
15
|
-
sub_service_id: number;
|
|
16
|
-
|
|
17
|
-
@Column({ type: "integer", nullable: false })
|
|
18
|
-
department_id: number;
|
|
19
|
-
|
|
20
|
-
@Column({ type: "integer", nullable: true })
|
|
21
|
-
section_id: number | null;
|
|
22
|
-
|
|
23
|
-
@Column({ type: "integer", nullable: true })
|
|
24
|
-
role_id: number | null;
|
|
25
|
-
|
|
26
|
-
@Column({
|
|
27
|
-
type: "enum",
|
|
28
|
-
enum: ServicesNotificationTriggerType,
|
|
29
|
-
nullable: false,
|
|
30
|
-
default: ServicesNotificationTriggerType.FINAL_APPROVAL
|
|
31
|
-
})
|
|
32
|
-
trigger: ServicesNotificationTriggerType;
|
|
33
|
-
|
|
34
|
-
@Column({ type: "boolean", nullable: false, default: true })
|
|
35
|
-
is_active: boolean;
|
|
36
|
-
|
|
37
|
-
constructor(
|
|
38
|
-
service_id: number,
|
|
39
|
-
sub_service_id: number,
|
|
40
|
-
department_id: number,
|
|
41
|
-
section_id: number | null = null,
|
|
42
|
-
role_id: number | null = null,
|
|
43
|
-
trigger: ServicesNotificationTriggerType = ServicesNotificationTriggerType.FINAL_APPROVAL,
|
|
44
|
-
is_active: boolean = true
|
|
45
|
-
) {
|
|
46
|
-
super();
|
|
47
|
-
this.service_id = service_id;
|
|
48
|
-
this.sub_service_id = sub_service_id;
|
|
49
|
-
this.department_id = department_id;
|
|
50
|
-
this.section_id = section_id;
|
|
51
|
-
this.role_id = role_id;
|
|
52
|
-
this.trigger = trigger;
|
|
53
|
-
this.is_active = is_active;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
1
|
+
import { Column, Entity } from "typeorm";
|
|
2
|
+
import { BaseModel } from "./BaseModel";
|
|
3
|
+
|
|
4
|
+
export enum ServicesNotificationTriggerType {
|
|
5
|
+
FINAL_APPROVAL = "final_approval",
|
|
6
|
+
EVERY_APPROVAL = "every_approval"
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
@Entity({ name: "services_notification_configs" })
|
|
10
|
+
export class ServicesNotificationConfigs extends BaseModel {
|
|
11
|
+
@Column({ type: "integer", nullable: false })
|
|
12
|
+
service_id: number;
|
|
13
|
+
|
|
14
|
+
@Column({ type: "integer", nullable: false })
|
|
15
|
+
sub_service_id: number;
|
|
16
|
+
|
|
17
|
+
@Column({ type: "integer", nullable: false })
|
|
18
|
+
department_id: number;
|
|
19
|
+
|
|
20
|
+
@Column({ type: "integer", nullable: true })
|
|
21
|
+
section_id: number | null;
|
|
22
|
+
|
|
23
|
+
@Column({ type: "integer", nullable: true })
|
|
24
|
+
role_id: number | null;
|
|
25
|
+
|
|
26
|
+
@Column({
|
|
27
|
+
type: "enum",
|
|
28
|
+
enum: ServicesNotificationTriggerType,
|
|
29
|
+
nullable: false,
|
|
30
|
+
default: ServicesNotificationTriggerType.FINAL_APPROVAL
|
|
31
|
+
})
|
|
32
|
+
trigger: ServicesNotificationTriggerType;
|
|
33
|
+
|
|
34
|
+
@Column({ type: "boolean", nullable: false, default: true })
|
|
35
|
+
is_active: boolean;
|
|
36
|
+
|
|
37
|
+
constructor(
|
|
38
|
+
service_id: number,
|
|
39
|
+
sub_service_id: number,
|
|
40
|
+
department_id: number,
|
|
41
|
+
section_id: number | null = null,
|
|
42
|
+
role_id: number | null = null,
|
|
43
|
+
trigger: ServicesNotificationTriggerType = ServicesNotificationTriggerType.FINAL_APPROVAL,
|
|
44
|
+
is_active: boolean = true
|
|
45
|
+
) {
|
|
46
|
+
super();
|
|
47
|
+
this.service_id = service_id;
|
|
48
|
+
this.sub_service_id = sub_service_id;
|
|
49
|
+
this.department_id = department_id;
|
|
50
|
+
this.section_id = section_id;
|
|
51
|
+
this.role_id = role_id;
|
|
52
|
+
this.trigger = trigger;
|
|
53
|
+
this.is_active = is_active;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { ViewColumn, ViewEntity } from "typeorm";
|
|
2
|
+
import { SlaRequestStatus } from "./SlaRequestModel";
|
|
3
|
+
|
|
4
|
+
/** Top-level `request_obj` keys omitted from `request_fields` (see sql/vw_sla_my_requests.sql). */
|
|
5
|
+
export const SLA_MY_REQUESTS_REQUEST_OBJ_EXCLUDED_KEYS = [
|
|
6
|
+
"id",
|
|
7
|
+
"status",
|
|
8
|
+
"role_id",
|
|
9
|
+
"user_id",
|
|
10
|
+
"createdBy",
|
|
11
|
+
"created_at",
|
|
12
|
+
"updated_by",
|
|
13
|
+
"updated_at",
|
|
14
|
+
"req_user_department_id",
|
|
15
|
+
"workflow_execution_id",
|
|
16
|
+
"department_id",
|
|
17
|
+
"req_user_section_id",
|
|
18
|
+
"service_type_id",
|
|
19
|
+
"service_type",
|
|
20
|
+
] as const;
|
|
21
|
+
|
|
22
|
+
const VW_SLA_MY_REQUESTS_SQL = `
|
|
23
|
+
SELECT
|
|
24
|
+
sr.id AS sla_request_id,
|
|
25
|
+
sr.user_id,
|
|
26
|
+
TRIM(COALESCE(creator.employee_name, ''))::TEXT AS created_by,
|
|
27
|
+
sr.created_at,
|
|
28
|
+
TRIM(COALESCE(dept.department_name, ''))::TEXT AS req_user_department_id,
|
|
29
|
+
TRIM(COALESCE(sec.section_name, ''))::TEXT AS req_user_section_id,
|
|
30
|
+
TRIM(COALESCE(svc.name, ''))::TEXT AS service_id,
|
|
31
|
+
TRIM(COALESCE(subsvc.sub_service_name, ''))::TEXT AS sub_service_id,
|
|
32
|
+
sr.status::TEXT AS status,
|
|
33
|
+
sr.request_id,
|
|
34
|
+
(
|
|
35
|
+
COALESCE(sr.request_obj, '{}'::jsonb)
|
|
36
|
+
- 'id'
|
|
37
|
+
- 'status'
|
|
38
|
+
- 'role_id'
|
|
39
|
+
- 'user_id'
|
|
40
|
+
- 'createdBy'
|
|
41
|
+
- 'created_at'
|
|
42
|
+
- 'updated_by'
|
|
43
|
+
- 'updated_at'
|
|
44
|
+
- 'req_user_department_id'
|
|
45
|
+
- 'workflow_execution_id'
|
|
46
|
+
- 'department_id'
|
|
47
|
+
- 'req_user_section_id'
|
|
48
|
+
- 'service_type_id'
|
|
49
|
+
- 'service_type'
|
|
50
|
+
) AS request_fields
|
|
51
|
+
FROM sla_requests sr
|
|
52
|
+
LEFT JOIN users creator
|
|
53
|
+
ON creator.id = sr.created_by AND COALESCE(creator.is_deleted, false) = false
|
|
54
|
+
LEFT JOIN departments dept
|
|
55
|
+
ON dept.id = sr.req_user_department_id AND COALESCE(dept.is_deleted, false) = false
|
|
56
|
+
LEFT JOIN sections sec
|
|
57
|
+
ON sec.id = sr.req_user_section_id AND COALESCE(sec.is_deleted, false) = false
|
|
58
|
+
LEFT JOIN caa_services svc
|
|
59
|
+
ON svc.id = sr.service_id AND COALESCE(svc.is_deleted, false) = false
|
|
60
|
+
LEFT JOIN caa_sub_services subsvc
|
|
61
|
+
ON subsvc.id = sr.sub_service_id AND COALESCE(subsvc.is_deleted, false) = false
|
|
62
|
+
WHERE COALESCE(sr.is_deleted, false) = false
|
|
63
|
+
`;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Read-only view for SLA "my requests" listings.
|
|
67
|
+
* Display-name columns reuse sla_requests field names; values come from joined lookup tables.
|
|
68
|
+
* Service-specific payload keys live in `request_fields` (filtered `request_obj`).
|
|
69
|
+
*/
|
|
70
|
+
@ViewEntity({
|
|
71
|
+
name: "vw_sla_my_requests",
|
|
72
|
+
expression: VW_SLA_MY_REQUESTS_SQL,
|
|
73
|
+
})
|
|
74
|
+
export class SlaMyRequestsView {
|
|
75
|
+
@ViewColumn()
|
|
76
|
+
sla_request_id: number;
|
|
77
|
+
|
|
78
|
+
/** Request owner (`sla_requests.user_id`) — filter with WHERE user_id = :userId for "my requests". */
|
|
79
|
+
@ViewColumn()
|
|
80
|
+
user_id: number;
|
|
81
|
+
|
|
82
|
+
@ViewColumn()
|
|
83
|
+
created_by: string;
|
|
84
|
+
|
|
85
|
+
@ViewColumn()
|
|
86
|
+
created_at: Date;
|
|
87
|
+
|
|
88
|
+
@ViewColumn()
|
|
89
|
+
req_user_department_id: string;
|
|
90
|
+
|
|
91
|
+
@ViewColumn()
|
|
92
|
+
req_user_section_id: string;
|
|
93
|
+
|
|
94
|
+
@ViewColumn()
|
|
95
|
+
service_id: string;
|
|
96
|
+
|
|
97
|
+
@ViewColumn()
|
|
98
|
+
sub_service_id: string;
|
|
99
|
+
|
|
100
|
+
@ViewColumn()
|
|
101
|
+
status: SlaRequestStatus | string;
|
|
102
|
+
|
|
103
|
+
@ViewColumn()
|
|
104
|
+
request_id: number;
|
|
105
|
+
|
|
106
|
+
/** Remaining `request_obj` keys after excluding workflow/common duplicates. */
|
|
107
|
+
@ViewColumn()
|
|
108
|
+
request_fields: Record<string, unknown>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Flatten view row: fixed columns plus each entry in `request_fields`. */
|
|
112
|
+
export function flattenSlaMyRequestsViewRow(
|
|
113
|
+
row: SlaMyRequestsView
|
|
114
|
+
): Record<string, unknown> {
|
|
115
|
+
const {
|
|
116
|
+
sla_request_id,
|
|
117
|
+
user_id,
|
|
118
|
+
created_by,
|
|
119
|
+
created_at,
|
|
120
|
+
req_user_department_id,
|
|
121
|
+
req_user_section_id,
|
|
122
|
+
service_id,
|
|
123
|
+
sub_service_id,
|
|
124
|
+
status,
|
|
125
|
+
request_id,
|
|
126
|
+
request_fields,
|
|
127
|
+
} = row;
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
sla_request_id,
|
|
131
|
+
user_id,
|
|
132
|
+
created_by,
|
|
133
|
+
created_at,
|
|
134
|
+
req_user_department_id,
|
|
135
|
+
req_user_section_id,
|
|
136
|
+
service_id,
|
|
137
|
+
sub_service_id,
|
|
138
|
+
status,
|
|
139
|
+
request_id,
|
|
140
|
+
...(request_fields ?? {}),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import { Column, Entity, Index } from "typeorm";
|
|
2
|
-
import { BaseModel } from "./BaseModel";
|
|
3
|
-
|
|
4
|
-
/** Workflow status for generic SLA-tracked service requests. */
|
|
5
|
-
export enum SlaRequestStatus {
|
|
6
|
-
PENDING = "Pending",
|
|
7
|
-
IN_PROGRESS = "In Progress",
|
|
8
|
-
APPROVED = "Approved",
|
|
9
|
-
REJECTED = "Rejected"
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Cross-service SLA request: common routing/workflow fields plus `request_obj`
|
|
14
|
-
* for service-specific payload (same common columns as `ServiceExtensionAfter60Request` lines 13–37).
|
|
15
|
-
*/
|
|
16
|
-
@Entity({ name: "sla_requests" })
|
|
17
|
-
/** Non-unique: same native `request_id` may be inserted more than once (e.g. workflow retries); scope in queries with service_id / workflow_execution_id as needed. */
|
|
18
|
-
@Index("idx_sla_requests_request_id", ["request_id"])
|
|
19
|
-
@Index("idx_sla_requests_user_id", ["user_id"])
|
|
20
|
-
@Index("idx_sla_requests_service_subservice", ["service_id", "sub_service_id"])
|
|
21
|
-
@Index("idx_sla_requests_workflow_execution_id", ["workflow_execution_id"])
|
|
22
|
-
@Index("idx_sla_requests_status", ["status"])
|
|
23
|
-
export class SlaRequest extends BaseModel {
|
|
24
|
-
@Column({ type: "int", nullable: true })
|
|
25
|
-
req_user_department_id: number | null;
|
|
26
|
-
|
|
27
|
-
@Column({ type: "int", nullable: true })
|
|
28
|
-
req_user_section_id: number | null;
|
|
29
|
-
|
|
30
|
-
@Column({ type: "int", nullable: true })
|
|
31
|
-
service_id: number | null;
|
|
32
|
-
|
|
33
|
-
@Column({ type: "int", nullable: true })
|
|
34
|
-
sub_service_id: number | null;
|
|
35
|
-
|
|
36
|
-
@Column({ type: "int", nullable: false })
|
|
37
|
-
user_id: number;
|
|
38
|
-
|
|
39
|
-
@Column({
|
|
40
|
-
type: "enum",
|
|
41
|
-
enum: SlaRequestStatus,
|
|
42
|
-
default: SlaRequestStatus.PENDING,
|
|
43
|
-
nullable: false
|
|
44
|
-
})
|
|
45
|
-
status: SlaRequestStatus;
|
|
46
|
-
|
|
47
|
-
@Column({ type: "varchar", length: 255, nullable: true })
|
|
48
|
-
workflow_execution_id: string | null;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Native service request PK this SLA row tracks (non-unique index; scope with service_id/sub_service_id in queries).
|
|
52
|
-
*/
|
|
53
|
-
@Column({ type: "int", nullable: false })
|
|
54
|
-
request_id: number;
|
|
55
|
-
|
|
56
|
-
/** Service-specific fields as JSON (shape defined per service / sub_service). */
|
|
57
|
-
@Column({ type: "jsonb", nullable: false, default: () => "'{}'::jsonb" })
|
|
58
|
-
request_obj: Record<string, unknown>;
|
|
59
|
-
|
|
60
|
-
constructor() {
|
|
61
|
-
super();
|
|
62
|
-
this.request_id = 0;
|
|
63
|
-
this.request_obj = {};
|
|
64
|
-
}
|
|
65
|
-
}
|
|
1
|
+
import { Column, Entity, Index } from "typeorm";
|
|
2
|
+
import { BaseModel } from "./BaseModel";
|
|
3
|
+
|
|
4
|
+
/** Workflow status for generic SLA-tracked service requests. */
|
|
5
|
+
export enum SlaRequestStatus {
|
|
6
|
+
PENDING = "Pending",
|
|
7
|
+
IN_PROGRESS = "In Progress",
|
|
8
|
+
APPROVED = "Approved",
|
|
9
|
+
REJECTED = "Rejected"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Cross-service SLA request: common routing/workflow fields plus `request_obj`
|
|
14
|
+
* for service-specific payload (same common columns as `ServiceExtensionAfter60Request` lines 13–37).
|
|
15
|
+
*/
|
|
16
|
+
@Entity({ name: "sla_requests" })
|
|
17
|
+
/** Non-unique: same native `request_id` may be inserted more than once (e.g. workflow retries); scope in queries with service_id / workflow_execution_id as needed. */
|
|
18
|
+
@Index("idx_sla_requests_request_id", ["request_id"])
|
|
19
|
+
@Index("idx_sla_requests_user_id", ["user_id"])
|
|
20
|
+
@Index("idx_sla_requests_service_subservice", ["service_id", "sub_service_id"])
|
|
21
|
+
@Index("idx_sla_requests_workflow_execution_id", ["workflow_execution_id"])
|
|
22
|
+
@Index("idx_sla_requests_status", ["status"])
|
|
23
|
+
export class SlaRequest extends BaseModel {
|
|
24
|
+
@Column({ type: "int", nullable: true })
|
|
25
|
+
req_user_department_id: number | null;
|
|
26
|
+
|
|
27
|
+
@Column({ type: "int", nullable: true })
|
|
28
|
+
req_user_section_id: number | null;
|
|
29
|
+
|
|
30
|
+
@Column({ type: "int", nullable: true })
|
|
31
|
+
service_id: number | null;
|
|
32
|
+
|
|
33
|
+
@Column({ type: "int", nullable: true })
|
|
34
|
+
sub_service_id: number | null;
|
|
35
|
+
|
|
36
|
+
@Column({ type: "int", nullable: false })
|
|
37
|
+
user_id: number;
|
|
38
|
+
|
|
39
|
+
@Column({
|
|
40
|
+
type: "enum",
|
|
41
|
+
enum: SlaRequestStatus,
|
|
42
|
+
default: SlaRequestStatus.PENDING,
|
|
43
|
+
nullable: false
|
|
44
|
+
})
|
|
45
|
+
status: SlaRequestStatus;
|
|
46
|
+
|
|
47
|
+
@Column({ type: "varchar", length: 255, nullable: true })
|
|
48
|
+
workflow_execution_id: string | null;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Native service request PK this SLA row tracks (non-unique index; scope with service_id/sub_service_id in queries).
|
|
52
|
+
*/
|
|
53
|
+
@Column({ type: "int", nullable: false })
|
|
54
|
+
request_id: number;
|
|
55
|
+
|
|
56
|
+
/** Service-specific fields as JSON (shape defined per service / sub_service). */
|
|
57
|
+
@Column({ type: "jsonb", nullable: false, default: () => "'{}'::jsonb" })
|
|
58
|
+
request_obj: Record<string, unknown>;
|
|
59
|
+
|
|
60
|
+
constructor() {
|
|
61
|
+
super();
|
|
62
|
+
this.request_id = 0;
|
|
63
|
+
this.request_obj = {};
|
|
64
|
+
}
|
|
65
|
+
}
|