@platform-modules/civil-aviation-authority 2.3.310 → 2.3.312

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.
Files changed (79) hide show
  1. package/dist/data-source.js +2 -0
  2. package/dist/i18n/workflow-chat-i18n.json +8 -0
  3. package/dist/i18n/workflow-chat-message.builder.d.ts +1 -1
  4. package/dist/i18n/workflow-chat-message.builder.js +21 -3
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.js +1 -0
  7. package/dist/models/ChatbotQnsAnsMappingModel.d.ts +8 -0
  8. package/dist/models/ChatbotQnsAnsMappingModel.js +40 -0
  9. package/dist/models/DocumentMetadataModel.d.ts +45 -0
  10. package/dist/models/DocumentMetadataModel.js +171 -0
  11. package/dist/models/DocumentationDepartmentsModel.d.ts +13 -0
  12. package/dist/models/DocumentationDepartmentsModel.js +53 -0
  13. package/dist/models/FolderModel.d.ts +16 -0
  14. package/dist/models/FolderModel.js +85 -0
  15. package/dist/models/ImportExportMaterialModels.d.ts +92 -0
  16. package/dist/models/ImportExportMaterialModels.js +307 -0
  17. package/dist/models/PermissionModel.d.ts +18 -0
  18. package/dist/models/PermissionModel.js +68 -0
  19. package/dist/models/SecurityAccessApprovalModel.d.ts +23 -0
  20. package/dist/models/SecurityAccessApprovalModel.js +82 -0
  21. package/dist/models/SecurityAccessAttachmentModel.d.ts +12 -0
  22. package/dist/models/SecurityAccessAttachmentModel.js +56 -0
  23. package/dist/models/SecurityAccessChatModel.d.ts +12 -0
  24. package/dist/models/SecurityAccessChatModel.js +56 -0
  25. package/dist/models/SecurityAccessRequestModel.d.ts +25 -0
  26. package/dist/models/SecurityAccessRequestModel.js +80 -0
  27. package/dist/models/SecurityAccessWorkflowModel.d.ts +24 -0
  28. package/dist/models/SecurityAccessWorkflowModel.js +84 -0
  29. package/dist/models/ServiceExtensionAfterAge60Models.d.ts +93 -0
  30. package/dist/models/ServiceExtensionAfterAge60Models.js +312 -0
  31. package/dist/models/SlaApprovalsViewModel.js +54 -47
  32. package/dist/models/SlaMyRequestsViewModel.d.ts +3 -0
  33. package/dist/models/SlaMyRequestsViewModel.js +22 -2
  34. package/dist/models/UUIDBaseModel.d.ts +14 -0
  35. package/dist/models/UUIDBaseModel.js +66 -0
  36. package/dist/models/WorkingHoursExtensionModels.d.ts +88 -0
  37. package/dist/models/WorkingHoursExtensionModels.js +295 -0
  38. package/package.json +1 -1
  39. package/scripts/sync-sla-reports-sql.js +92 -92
  40. package/sql/README.md +21 -21
  41. package/sql/create_chatbot_qns_ans_mapping.sql +25 -0
  42. package/sql/sla_reports_admin_procedures.sql +323 -304
  43. package/sql/sla_reports_approvals_workbook.sql +430 -383
  44. package/sql/sla_reports_procedures.sql +886 -886
  45. package/sql/user_role_department_section_validation.sql +214 -0
  46. package/sql/vw_sla_approvals.sql +115 -108
  47. package/sql/vw_sla_my_requests.sql +58 -53
  48. package/src/data-source.ts +2 -0
  49. package/src/i18n/workflow-chat-i18n.json +8 -0
  50. package/src/i18n/workflow-chat-message.builder.ts +27 -3
  51. package/src/index.ts +1 -0
  52. package/src/models/AccessCardRequestModel.ts +135 -135
  53. package/src/models/AirportEntryPermitModel.ts +276 -276
  54. package/src/models/AnnualTrainingPlanRequestModel.ts +153 -153
  55. package/src/models/ChatbotQnsAnsMappingModel.ts +21 -0
  56. package/src/models/DocumentDriveModel.ts +28 -28
  57. package/src/models/DocumentFolderModel.ts +45 -45
  58. package/src/models/HotelApprovalModel.ts +83 -83
  59. package/src/models/HousingContractCancelApprovalModel.ts +64 -64
  60. package/src/models/HousingContractRenewalApprovalModel.ts +64 -64
  61. package/src/models/ITRequestAttachmentModel.ts +73 -73
  62. package/src/models/ItApprovalsModel.ts +84 -84
  63. package/src/models/LegalConsultationApprovalModel.ts +65 -65
  64. package/src/models/MissionTravelPassportExpiryNotificationConfigModel.ts +36 -36
  65. package/src/models/NotificationModel.ts +89 -89
  66. package/src/models/ResidentialUnitRentalApprovalModel.ts +143 -143
  67. package/src/models/ServiceExtensionAfter60ApprovalModel.ts +87 -87
  68. package/src/models/ServiceSlaApprovalModel.ts +64 -64
  69. package/src/models/ServicesNotificationConfigModel.ts +55 -55
  70. package/src/models/SlaApprovalsViewModel.ts +142 -135
  71. package/src/models/SlaMyRequestsViewModel.ts +21 -1
  72. package/src/models/StudyLeaveRequestModel.ts +144 -144
  73. package/src/models/TrainingRequestModel.ts +164 -164
  74. package/src/models/TrainingRoomBookingRequestModel.ts +142 -142
  75. package/src/models/TrainingRoomNotificationConfigModel.ts +30 -30
  76. package/src/models/role.ts +34 -34
  77. package/src/sla/sla-table-sync.service.ts +90 -90
  78. package/dist/helpers/cancellation-bilingual-persist.helper.d.ts +0 -37
  79. package/dist/helpers/cancellation-bilingual-persist.helper.js +0 -77
@@ -1,34 +1,34 @@
1
- /** *
2
- @author
3
- Amnet Digital
4
- @date
5
- 2024-05-20
6
- @Model
7
- Role
8
- @usage
9
- Userrole Information will store
10
- */
11
-
12
- import { Column, Entity } from "typeorm";
13
- import { BaseModel } from './BaseModel';
14
-
15
- @Entity({ name: 'role' })
16
- export class Role extends BaseModel {
17
-
18
- @Column({ nullable: true })
19
- name: string;
20
-
21
- @Column({ type: 'varchar', length: 255, nullable: true })
22
- arabic_name: string | null;
23
-
24
- @Column({ nullable: true })
25
- is_deleted?: boolean;
26
-
27
-
28
- constructor(name: string, is_deleted: boolean, arabic_name: string | null = null) {
29
- super();
30
- this.name = name;
31
- this.is_deleted = is_deleted;
32
- this.arabic_name = arabic_name;
33
- }
34
- }
1
+ /** *
2
+ @author
3
+ Amnet Digital
4
+ @date
5
+ 2024-05-20
6
+ @Model
7
+ Role
8
+ @usage
9
+ Userrole Information will store
10
+ */
11
+
12
+ import { Column, Entity } from "typeorm";
13
+ import { BaseModel } from './BaseModel';
14
+
15
+ @Entity({ name: 'role' })
16
+ export class Role extends BaseModel {
17
+
18
+ @Column({ nullable: true })
19
+ name: string;
20
+
21
+ @Column({ type: 'varchar', length: 255, nullable: true })
22
+ arabic_name: string | null;
23
+
24
+ @Column({ nullable: true })
25
+ is_deleted?: boolean;
26
+
27
+
28
+ constructor(name: string, is_deleted: boolean, arabic_name: string | null = null) {
29
+ super();
30
+ this.name = name;
31
+ this.is_deleted = is_deleted;
32
+ this.arabic_name = arabic_name;
33
+ }
34
+ }
@@ -1,90 +1,90 @@
1
- import { EntityManager } from "typeorm";
2
- import { ServiceSlaApproval } from "../models/ServiceSlaApprovalModel";
3
- import { SlaRequest, SlaRequestStatus } from "../models/SlaRequestModel";
4
-
5
- export type PatchSlaApprovalTableInput = Partial<{
6
- approval_status: string;
7
- approver_user_id: number | null;
8
- approver_role_id: number | null;
9
- department_id: number | null;
10
- section_id: number | null;
11
- level: number;
12
- delegate_user_id: number | null;
13
- approved_by: number | null;
14
- comment: string | null;
15
- }>;
16
-
17
- export type PatchSlaRequestTableInput = Partial<{
18
- status: SlaRequestStatus | string;
19
- workflow_execution_id: string | null;
20
- }>;
21
-
22
- function stripUndefined<T extends Record<string, unknown>>(obj: T): Partial<T> {
23
- const out: Partial<T> = {};
24
- for (const key of Object.keys(obj)) {
25
- const v = obj[key];
26
- if (v !== undefined) {
27
- (out as Record<string, unknown>)[key] = v;
28
- }
29
- }
30
- return out;
31
- }
32
-
33
- /**
34
- * TypeORM patches for `sla_approval` and `sla_requests` by the keys used at insert time
35
- * (`source_approval_id` and native `request_id`). Safe to call from any service that shares the DB;
36
- * failures are swallowed so missing SLA rows never block business transactions.
37
- */
38
- export class SlaTableSyncService {
39
- static async patchSlaApprovalBySourceApprovalId(
40
- manager: EntityManager,
41
- sourceApprovalId: number,
42
- patch: PatchSlaApprovalTableInput,
43
- updatedBy?: number | null
44
- ): Promise<void> {
45
- if (!Number.isFinite(sourceApprovalId)) {
46
- return;
47
- }
48
- try {
49
- const setPayload: Record<string, unknown> = {
50
- ...stripUndefined(patch as Record<string, unknown>),
51
- updated_at: new Date()
52
- };
53
- if (updatedBy != null) {
54
- setPayload.updated_by = updatedBy;
55
- }
56
- await manager.getRepository(ServiceSlaApproval).update(
57
- { source_approval_id: sourceApprovalId, is_deleted: false },
58
- setPayload as any
59
- );
60
- } catch {
61
- // non-fatal
62
- }
63
- }
64
-
65
- static async patchSlaRequestByNativeRequestId(
66
- manager: EntityManager,
67
- nativeRequestId: number,
68
- patch: PatchSlaRequestTableInput,
69
- updatedBy?: number | null
70
- ): Promise<void> {
71
- if (!Number.isFinite(nativeRequestId) || nativeRequestId < 1) {
72
- return;
73
- }
74
- try {
75
- const setPayload: Record<string, unknown> = {
76
- ...stripUndefined(patch as Record<string, unknown>),
77
- updated_at: new Date()
78
- };
79
- if (updatedBy != null) {
80
- setPayload.updated_by = updatedBy;
81
- }
82
- await manager.getRepository(SlaRequest).update(
83
- { request_id: nativeRequestId, is_deleted: false },
84
- setPayload as any
85
- );
86
- } catch {
87
- // non-fatal
88
- }
89
- }
90
- }
1
+ import { EntityManager } from "typeorm";
2
+ import { ServiceSlaApproval } from "../models/ServiceSlaApprovalModel";
3
+ import { SlaRequest, SlaRequestStatus } from "../models/SlaRequestModel";
4
+
5
+ export type PatchSlaApprovalTableInput = Partial<{
6
+ approval_status: string;
7
+ approver_user_id: number | null;
8
+ approver_role_id: number | null;
9
+ department_id: number | null;
10
+ section_id: number | null;
11
+ level: number;
12
+ delegate_user_id: number | null;
13
+ approved_by: number | null;
14
+ comment: string | null;
15
+ }>;
16
+
17
+ export type PatchSlaRequestTableInput = Partial<{
18
+ status: SlaRequestStatus | string;
19
+ workflow_execution_id: string | null;
20
+ }>;
21
+
22
+ function stripUndefined<T extends Record<string, unknown>>(obj: T): Partial<T> {
23
+ const out: Partial<T> = {};
24
+ for (const key of Object.keys(obj)) {
25
+ const v = obj[key];
26
+ if (v !== undefined) {
27
+ (out as Record<string, unknown>)[key] = v;
28
+ }
29
+ }
30
+ return out;
31
+ }
32
+
33
+ /**
34
+ * TypeORM patches for `sla_approval` and `sla_requests` by the keys used at insert time
35
+ * (`source_approval_id` and native `request_id`). Safe to call from any service that shares the DB;
36
+ * failures are swallowed so missing SLA rows never block business transactions.
37
+ */
38
+ export class SlaTableSyncService {
39
+ static async patchSlaApprovalBySourceApprovalId(
40
+ manager: EntityManager,
41
+ sourceApprovalId: number,
42
+ patch: PatchSlaApprovalTableInput,
43
+ updatedBy?: number | null
44
+ ): Promise<void> {
45
+ if (!Number.isFinite(sourceApprovalId)) {
46
+ return;
47
+ }
48
+ try {
49
+ const setPayload: Record<string, unknown> = {
50
+ ...stripUndefined(patch as Record<string, unknown>),
51
+ updated_at: new Date()
52
+ };
53
+ if (updatedBy != null) {
54
+ setPayload.updated_by = updatedBy;
55
+ }
56
+ await manager.getRepository(ServiceSlaApproval).update(
57
+ { source_approval_id: sourceApprovalId, is_deleted: false },
58
+ setPayload as any
59
+ );
60
+ } catch {
61
+ // non-fatal
62
+ }
63
+ }
64
+
65
+ static async patchSlaRequestByNativeRequestId(
66
+ manager: EntityManager,
67
+ nativeRequestId: number,
68
+ patch: PatchSlaRequestTableInput,
69
+ updatedBy?: number | null
70
+ ): Promise<void> {
71
+ if (!Number.isFinite(nativeRequestId) || nativeRequestId < 1) {
72
+ return;
73
+ }
74
+ try {
75
+ const setPayload: Record<string, unknown> = {
76
+ ...stripUndefined(patch as Record<string, unknown>),
77
+ updated_at: new Date()
78
+ };
79
+ if (updatedBy != null) {
80
+ setPayload.updated_by = updatedBy;
81
+ }
82
+ await manager.getRepository(SlaRequest).update(
83
+ { request_id: nativeRequestId, is_deleted: false },
84
+ setPayload as any
85
+ );
86
+ } catch {
87
+ // non-fatal
88
+ }
89
+ }
90
+ }
@@ -1,37 +0,0 @@
1
- import type { EntityManager } from 'typeorm';
2
- import { CancellationMessageType } from '../models/CancellationChatModel';
3
- import { CancellationWorkFlowStatus } from '../models/CancellationWorkflowModel';
4
- export type CancellationWorkflowRowInput = {
5
- request_id: number;
6
- service_id?: number | null;
7
- sub_service_id?: number | null;
8
- content: string;
9
- content_ar?: string | null;
10
- status: CancellationWorkFlowStatus;
11
- status_ar?: string | null;
12
- user_id?: number | null;
13
- role_id?: number | null;
14
- department_id?: number | null;
15
- section_id?: number | null;
16
- step_order?: number | null;
17
- created_by?: number | null;
18
- };
19
- export type CancellationChatRowInput = {
20
- request_id: number;
21
- service_id?: number | null;
22
- sub_service_id?: number | null;
23
- user_id: number;
24
- role_id?: number | null;
25
- message: string;
26
- message_ar?: string | null;
27
- messageType?: CancellationMessageType;
28
- status?: string | null;
29
- status_ar?: string | null;
30
- created_by?: number | string | null;
31
- };
32
- /** Force-persist Arabic workflow columns (guards against stale TypeORM entity metadata). */
33
- export declare function patchCancellationWorkflowArabic(manager: EntityManager, workflowId: number, contentAr: string | null, statusAr: string | null): Promise<void>;
34
- /** Force-persist Arabic chat columns (guards against stale TypeORM entity metadata). */
35
- export declare function patchCancellationChatArabic(manager: EntityManager, chatId: number, messageAr: string | null, statusAr: string | null): Promise<void>;
36
- export declare function insertCancellationWorkflowRow(manager: EntityManager, input: CancellationWorkflowRowInput): Promise<number>;
37
- export declare function insertCancellationChatRow(manager: EntityManager, input: CancellationChatRowInput): Promise<number>;
@@ -1,77 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.patchCancellationWorkflowArabic = patchCancellationWorkflowArabic;
4
- exports.patchCancellationChatArabic = patchCancellationChatArabic;
5
- exports.insertCancellationWorkflowRow = insertCancellationWorkflowRow;
6
- exports.insertCancellationChatRow = insertCancellationChatRow;
7
- const CancellationChatModel_1 = require("../models/CancellationChatModel");
8
- const CancellationWorkflowModel_1 = require("../models/CancellationWorkflowModel");
9
- const workflow_chat_i18n_1 = require("../i18n/workflow-chat-i18n");
10
- function resolveWorkflowRowId(insertResult) {
11
- const id = insertResult.raw?.[0]?.id ?? insertResult.identifiers?.[0]?.id;
12
- if (!id) {
13
- throw new Error('Failed to insert cancellation workflow row');
14
- }
15
- return id;
16
- }
17
- function resolveChatRowId(insertResult) {
18
- const id = insertResult.raw?.[0]?.id ?? insertResult.identifiers?.[0]?.id;
19
- if (!id) {
20
- throw new Error('Failed to insert cancellation chat row');
21
- }
22
- return id;
23
- }
24
- /** Force-persist Arabic workflow columns (guards against stale TypeORM entity metadata). */
25
- async function patchCancellationWorkflowArabic(manager, workflowId, contentAr, statusAr) {
26
- await manager.query(`UPDATE cancellation_workflows
27
- SET content_ar = $1,
28
- status_ar = $2,
29
- updated_at = CURRENT_TIMESTAMP
30
- WHERE id = $3`, [contentAr, statusAr, workflowId]);
31
- }
32
- /** Force-persist Arabic chat columns (guards against stale TypeORM entity metadata). */
33
- async function patchCancellationChatArabic(manager, chatId, messageAr, statusAr) {
34
- await manager.query(`UPDATE cancellation_chats
35
- SET message_ar = $1,
36
- status_ar = $2,
37
- updated_at = CURRENT_TIMESTAMP
38
- WHERE id = $3`, [messageAr, statusAr, chatId]);
39
- }
40
- async function insertCancellationWorkflowRow(manager, input) {
41
- const contentAr = input.content_ar ?? null;
42
- const statusAr = input.status_ar ?? (0, workflow_chat_i18n_1.resolveWorkflowStatusAr)(input.status);
43
- const insertResult = await manager
44
- .createQueryBuilder()
45
- .insert()
46
- .into(CancellationWorkflowModel_1.CancellationWorkFlow)
47
- .values({
48
- ...input,
49
- content_ar: contentAr,
50
- status_ar: statusAr,
51
- })
52
- .returning('id')
53
- .execute();
54
- const id = resolveWorkflowRowId(insertResult);
55
- await patchCancellationWorkflowArabic(manager, id, contentAr, statusAr);
56
- return id;
57
- }
58
- async function insertCancellationChatRow(manager, input) {
59
- const messageAr = input.message_ar ?? null;
60
- const statusAr = input.status_ar ?? (0, workflow_chat_i18n_1.resolveChatStatusAr)(input.status ?? null);
61
- const messageType = input.messageType ?? CancellationChatModel_1.CancellationMessageType.TEXT;
62
- const insertResult = await manager
63
- .createQueryBuilder()
64
- .insert()
65
- .into(CancellationChatModel_1.CancellationRequestChat)
66
- .values({
67
- ...input,
68
- message_ar: messageAr,
69
- status_ar: statusAr,
70
- messageType,
71
- })
72
- .returning('id')
73
- .execute();
74
- const id = resolveChatRowId(insertResult);
75
- await patchCancellationChatArabic(manager, id, messageAr, statusAr);
76
- return id;
77
- }