@platform-modules/civil-aviation-authority 2.3.338 → 2.3.339

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 (84) hide show
  1. package/.env +19 -10
  2. package/dist/data-source.js +0 -2
  3. package/dist/index.d.ts +0 -1
  4. package/dist/index.js +0 -1
  5. package/dist/models/DocumentMetadataModel.d.ts +45 -0
  6. package/dist/models/DocumentMetadataModel.js +171 -0
  7. package/dist/models/DocumentationDepartmentsModel.d.ts +13 -0
  8. package/dist/models/DocumentationDepartmentsModel.js +53 -0
  9. package/dist/models/FolderModel.d.ts +16 -0
  10. package/dist/models/FolderModel.js +85 -0
  11. package/dist/models/ImportExportMaterialModels.d.ts +92 -0
  12. package/dist/models/ImportExportMaterialModels.js +307 -0
  13. package/dist/models/PermissionModel.d.ts +18 -0
  14. package/dist/models/PermissionModel.js +68 -0
  15. package/dist/models/ScholarshipChatModel.d.ts +3 -0
  16. package/dist/models/ScholarshipChatModel.js +12 -0
  17. package/dist/models/ScholarshipRequestModel.d.ts +10 -0
  18. package/dist/models/ScholarshipRequestModel.js +30 -1
  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 -54
  32. package/dist/models/UUIDBaseModel.d.ts +14 -0
  33. package/dist/models/UUIDBaseModel.js +66 -0
  34. package/dist/models/WorkingHoursExtensionModels.d.ts +88 -0
  35. package/dist/models/WorkingHoursExtensionModels.js +295 -0
  36. package/package.json +1 -1
  37. package/scripts/sync-sla-reports-sql.js +92 -92
  38. package/sql/README.md +21 -21
  39. package/sql/add_annual_training_plan_reference_number.sql +6 -6
  40. package/sql/add_scholarship_request_extra_fields.sql +45 -0
  41. package/sql/add_training_request_reference_number.sql +9 -9
  42. package/sql/add_training_room_booking_records_reference.sql +19 -19
  43. package/sql/sla_reports_admin_procedures.sql +322 -322
  44. package/sql/sla_reports_approvals_workbook.sql +427 -427
  45. package/sql/sla_reports_procedures.sql +883 -883
  46. package/sql/update_scholarship_workflow_version_2.sql +11 -0
  47. package/sql/vw_sla_approvals.sql +115 -115
  48. package/sql/vw_sla_my_requests.sql +58 -58
  49. package/src/data-source.ts +0 -2
  50. package/src/index.ts +0 -1
  51. package/src/models/AccessCardRequestModel.ts +135 -135
  52. package/src/models/AirportEntryPermitModel.ts +276 -276
  53. package/src/models/AnnualTrainingPlanRequestModel.ts +156 -156
  54. package/src/models/DocumentDriveModel.ts +28 -28
  55. package/src/models/DocumentFolderModel.ts +45 -45
  56. package/src/models/HotelApprovalModel.ts +83 -83
  57. package/src/models/HousingContractCancelApprovalModel.ts +64 -64
  58. package/src/models/HousingContractRenewalApprovalModel.ts +64 -64
  59. package/src/models/ITRequestAttachmentModel.ts +73 -73
  60. package/src/models/ItApprovalsModel.ts +84 -84
  61. package/src/models/LegalConsultationApprovalModel.ts +65 -65
  62. package/src/models/MissionTravelPassportExpiryNotificationConfigModel.ts +36 -36
  63. package/src/models/NotificationModel.ts +89 -89
  64. package/src/models/ResidentialUnitRentalApprovalModel.ts +143 -143
  65. package/src/models/ScholarshipChatModel.ts +9 -0
  66. package/src/models/ScholarshipRequestModel.ts +23 -0
  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 -142
  71. package/src/models/StudyLeaveRequestModel.ts +173 -173
  72. package/src/models/TrainingRequestModel.ts +169 -169
  73. package/src/models/TrainingRoomBookingRequestModel.ts +178 -178
  74. package/src/models/TrainingRoomBookingWorkflowModel.ts +81 -81
  75. package/src/models/TrainingRoomNotificationConfigModel.ts +30 -30
  76. package/src/models/role.ts +34 -34
  77. package/src/scripts.ts +20 -20
  78. package/src/sla/sla-table-sync.service.ts +90 -90
  79. package/dist/helpers/cancellation-bilingual-persist.helper.d.ts +0 -37
  80. package/dist/helpers/cancellation-bilingual-persist.helper.js +0 -77
  81. package/dist/models/HelpContentCategoryModel.d.ts +0 -6
  82. package/dist/models/HelpContentCategoryModel.js +0 -34
  83. package/sql/add_help_content_categories_name_arabic.sql +0 -2
  84. package/src/models/HelpContentCategoryModel.ts +0 -20
package/src/scripts.ts CHANGED
@@ -1,20 +1,20 @@
1
- import { AppDataSource } from './data-source';
2
-
3
-
4
-
5
- AppDataSource.initialize()
6
-
7
- .then(() => {
8
-
9
- console.log('✅ Database schema synchronized successfully.');
10
-
11
- })
12
-
13
- .catch((error: any) => {
14
-
15
- console.error('❌ Error during schema synchronization:', error);
16
-
17
- process.exit(1);
18
-
19
- });
20
-
1
+ import { AppDataSource } from './data-source';
2
+
3
+
4
+
5
+ AppDataSource.initialize()
6
+
7
+ .then(() => {
8
+
9
+ console.log('✅ Database schema synchronized successfully.');
10
+
11
+ })
12
+
13
+ .catch((error: any) => {
14
+
15
+ console.error('❌ Error during schema synchronization:', error);
16
+
17
+ process.exit(1);
18
+
19
+ });
20
+
@@ -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
- }
@@ -1,6 +0,0 @@
1
- import { BaseModel } from './BaseModel';
2
- export declare class HelpContentCategories extends BaseModel {
3
- name: string;
4
- name_arabic: string | null;
5
- constructor(name: string);
6
- }
@@ -1,34 +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.HelpContentCategories = void 0;
13
- const typeorm_1 = require("typeorm");
14
- const BaseModel_1 = require("./BaseModel");
15
- let HelpContentCategories = class HelpContentCategories extends BaseModel_1.BaseModel {
16
- constructor(name) {
17
- super();
18
- this.name = name;
19
- this.name_arabic = null;
20
- }
21
- };
22
- exports.HelpContentCategories = HelpContentCategories;
23
- __decorate([
24
- (0, typeorm_1.Column)({ nullable: true }),
25
- __metadata("design:type", String)
26
- ], HelpContentCategories.prototype, "name", void 0);
27
- __decorate([
28
- (0, typeorm_1.Column)({ type: 'varchar', length: 500, nullable: true }),
29
- __metadata("design:type", Object)
30
- ], HelpContentCategories.prototype, "name_arabic", void 0);
31
- exports.HelpContentCategories = HelpContentCategories = __decorate([
32
- (0, typeorm_1.Entity)({ name: 'help_content_categories' }),
33
- __metadata("design:paramtypes", [String])
34
- ], HelpContentCategories);
@@ -1,2 +0,0 @@
1
- ALTER TABLE help_content_categories
2
- ADD COLUMN IF NOT EXISTS name_arabic VARCHAR(500) NULL;
@@ -1,20 +0,0 @@
1
- import { Column, Entity } from "typeorm";
2
- import { BaseModel } from './BaseModel';
3
-
4
- @Entity({ name: 'help_content_categories' })
5
- export class HelpContentCategories extends BaseModel {
6
-
7
- @Column({ nullable: true })
8
- name: string;
9
-
10
- @Column({ type: 'varchar', length: 500, nullable: true })
11
- name_arabic: string | null;
12
-
13
- constructor(
14
- name: string,
15
- ) {
16
- super();
17
- this.name = name;
18
- this.name_arabic = null;
19
- }
20
- }