@platform-modules/civil-aviation-authority 2.3.256 → 2.3.258
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SlaRequestStatus } from "./SlaRequestModel";
|
|
2
2
|
/** Top-level `request_obj` keys omitted from `request_fields` (see sql/vw_sla_my_requests.sql). */
|
|
3
|
-
export declare const SLA_MY_REQUESTS_REQUEST_OBJ_EXCLUDED_KEYS: readonly ["id", "status", "role_id", "user_id", "createdBy", "created_at", "updated_by", "updated_at", "req_user_department_id", "workflow_execution_id", "department_id", "req_user_section_id", "service_type_id", "service_type"];
|
|
3
|
+
export declare const SLA_MY_REQUESTS_REQUEST_OBJ_EXCLUDED_KEYS: readonly ["id", "status", "role_id", "user_id", "createdBy", "created_at", "updated_by", "updated_at", "req_user_department_id", "workflow_execution_id", "department_id", "req_user_section_id", "service_type_id", "service_type", "created_by", "service_id", "sub_service_id", "attachments"];
|
|
4
4
|
/**
|
|
5
5
|
* Read-only view for SLA "my requests" listings.
|
|
6
6
|
* Display-name columns reuse sla_requests field names; values come from joined lookup tables.
|
|
@@ -28,6 +28,10 @@ exports.SLA_MY_REQUESTS_REQUEST_OBJ_EXCLUDED_KEYS = [
|
|
|
28
28
|
"req_user_section_id",
|
|
29
29
|
"service_type_id",
|
|
30
30
|
"service_type",
|
|
31
|
+
"created_by",
|
|
32
|
+
"service_id",
|
|
33
|
+
"sub_service_id",
|
|
34
|
+
"attachments",
|
|
31
35
|
];
|
|
32
36
|
const VW_SLA_MY_REQUESTS_SQL = `
|
|
33
37
|
SELECT
|
|
@@ -57,6 +61,10 @@ SELECT
|
|
|
57
61
|
- 'req_user_section_id'
|
|
58
62
|
- 'service_type_id'
|
|
59
63
|
- 'service_type'
|
|
64
|
+
- 'created_by'
|
|
65
|
+
- 'service_id'
|
|
66
|
+
- 'sub_service_id'
|
|
67
|
+
- 'attachments'
|
|
60
68
|
) AS request_fields
|
|
61
69
|
FROM sla_requests sr
|
|
62
70
|
LEFT JOIN users creator
|
package/package.json
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
-- SLA "my requests" read model: joined display names + filtered request_obj payload.
|
|
2
|
+
-- Run once against the EmpPortal PostgreSQL database:
|
|
3
|
+
-- psql -U <user> -d <database> -f sql/vw_sla_my_requests.sql
|
|
4
|
+
|
|
5
|
+
CREATE OR REPLACE VIEW vw_sla_my_requests AS
|
|
6
|
+
SELECT
|
|
7
|
+
sr.id AS sla_request_id,
|
|
8
|
+
sr.user_id,
|
|
9
|
+
TRIM(COALESCE(creator.employee_name, ''))::TEXT AS created_by,
|
|
10
|
+
sr.created_at,
|
|
11
|
+
TRIM(COALESCE(dept.department_name, ''))::TEXT AS req_user_department_id,
|
|
12
|
+
TRIM(COALESCE(sec.section_name, ''))::TEXT AS req_user_section_id,
|
|
13
|
+
TRIM(COALESCE(svc.name, ''))::TEXT AS service_id,
|
|
14
|
+
TRIM(COALESCE(subsvc.sub_service_name, ''))::TEXT AS sub_service_id,
|
|
15
|
+
sr.status::TEXT AS status,
|
|
16
|
+
sr.request_id,
|
|
17
|
+
(
|
|
18
|
+
COALESCE(sr.request_obj, '{}'::jsonb)
|
|
19
|
+
- 'id'
|
|
20
|
+
- 'status'
|
|
21
|
+
- 'role_id'
|
|
22
|
+
- 'user_id'
|
|
23
|
+
- 'createdBy'
|
|
24
|
+
- 'created_at'
|
|
25
|
+
- 'updated_by'
|
|
26
|
+
- 'updated_at'
|
|
27
|
+
- 'req_user_department_id'
|
|
28
|
+
- 'workflow_execution_id'
|
|
29
|
+
- 'department_id'
|
|
30
|
+
- 'req_user_section_id'
|
|
31
|
+
- 'service_type_id'
|
|
32
|
+
- 'service_type'
|
|
33
|
+
- 'created_by'
|
|
34
|
+
- 'service_id'
|
|
35
|
+
- 'sub_service_id'
|
|
36
|
+
- 'attachments'
|
|
37
|
+
) AS request_fields
|
|
38
|
+
FROM sla_requests sr
|
|
39
|
+
LEFT JOIN users creator
|
|
40
|
+
ON creator.id = sr.created_by AND COALESCE(creator.is_deleted, false) = false
|
|
41
|
+
LEFT JOIN departments dept
|
|
42
|
+
ON dept.id = sr.req_user_department_id AND COALESCE(dept.is_deleted, false) = false
|
|
43
|
+
LEFT JOIN sections sec
|
|
44
|
+
ON sec.id = sr.req_user_section_id AND COALESCE(sec.is_deleted, false) = false
|
|
45
|
+
LEFT JOIN caa_services svc
|
|
46
|
+
ON svc.id = sr.service_id AND COALESCE(svc.is_deleted, false) = false
|
|
47
|
+
LEFT JOIN caa_sub_services subsvc
|
|
48
|
+
ON subsvc.id = sr.sub_service_id AND COALESCE(subsvc.is_deleted, false) = false
|
|
49
|
+
WHERE COALESCE(sr.is_deleted, false) = false;
|
|
@@ -17,6 +17,10 @@ export const SLA_MY_REQUESTS_REQUEST_OBJ_EXCLUDED_KEYS = [
|
|
|
17
17
|
"req_user_section_id",
|
|
18
18
|
"service_type_id",
|
|
19
19
|
"service_type",
|
|
20
|
+
"created_by",
|
|
21
|
+
"service_id",
|
|
22
|
+
"sub_service_id",
|
|
23
|
+
"attachments",
|
|
20
24
|
] as const;
|
|
21
25
|
|
|
22
26
|
const VW_SLA_MY_REQUESTS_SQL = `
|
|
@@ -47,6 +51,10 @@ SELECT
|
|
|
47
51
|
- 'req_user_section_id'
|
|
48
52
|
- 'service_type_id'
|
|
49
53
|
- 'service_type'
|
|
54
|
+
- 'created_by'
|
|
55
|
+
- 'service_id'
|
|
56
|
+
- 'sub_service_id'
|
|
57
|
+
- 'attachments'
|
|
50
58
|
) AS request_fields
|
|
51
59
|
FROM sla_requests sr
|
|
52
60
|
LEFT JOIN users creator
|