@platform-modules/civil-aviation-authority 2.3.152 → 2.3.156

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 (34) hide show
  1. package/.env +10 -10
  2. package/dist/models/AccommodationRequestModel.d.ts +7 -4
  3. package/dist/models/AccommodationRequestModel.js +12 -3
  4. package/dist/models/ITApprovalSettings.d.ts +7 -0
  5. package/dist/models/ITApprovalSettings.js +40 -0
  6. package/dist/models/ITServicesTypesMuscatModel.d.ts +6 -0
  7. package/dist/models/ITServicesTypesMuscatModel.js +34 -0
  8. package/dist/models/ITServicesTypesSalalahModel.d.ts +6 -0
  9. package/dist/models/ITServicesTypesSalalahModel.js +34 -0
  10. package/dist/models/LegalComplaintRequestModel.d.ts +101 -6
  11. package/dist/models/LegalComplaintRequestModel.js +257 -5
  12. package/dist/models/Workflows.d.ts +9 -0
  13. package/dist/models/Workflows.js +31 -0
  14. package/package.json +1 -1
  15. package/src/models/AccommodationApprovalModel.ts +8 -8
  16. package/src/models/AccommodationRequestModel.ts +54 -45
  17. package/src/models/AnnualIncrementRequestEmployeeModel.ts +65 -65
  18. package/src/models/AnnualIncrementRequestModel.ts +25 -25
  19. package/src/models/AppealAgainstAdministrativeDecisionRequestModel.ts +23 -23
  20. package/src/models/CAAServices.ts +33 -33
  21. package/src/models/CAASubServices.ts +33 -33
  22. package/src/models/CAIRatingMasterModel.ts +39 -39
  23. package/src/models/CSRMBusinessImpactRatingMasterModel.ts +25 -25
  24. package/src/models/CSRMLikelihoodMasterModel.ts +25 -25
  25. package/src/models/CashAllowanceLeaveRequestModel.ts +11 -11
  26. package/src/models/CyberSecurityAuditRequestModel.ts +32 -32
  27. package/src/models/HrServiceRequestModel.ts +193 -193
  28. package/src/models/LegalComplaintRequestModel.ts +322 -8
  29. package/src/models/PerformanceCyclePeriodModel.ts +26 -26
  30. package/src/models/PerformanceGoalMasterModel.ts +27 -27
  31. package/src/models/PerformanceManagementRequestGoalModel.ts +46 -46
  32. package/src/models/PerformanceManagementRequestModel.ts +14 -14
  33. package/src/models/PromotionRequestModel.ts +11 -11
  34. package/src/models/UserSkillModel.ts +56 -56
package/.env CHANGED
@@ -1,12 +1,12 @@
1
- DB_HOST=164.52.222.169
2
- DB_PORT=5432
3
- DB_USER=postgres_admin_user
4
- DB_PASS=pg_admin_user_pwd_caa_fa_$%^&OIukhjgcvbn
5
- DB_NAME=CAA
1
+ # DB_HOST=164.52.222.169
2
+ # DB_PORT=5432
3
+ # DB_USER=postgres_admin_user
4
+ # DB_PASS=pg_admin_user_pwd_caa_fa_$%^&OIukhjgcvbn
5
+ # DB_NAME=CAA
6
6
 
7
7
 
8
- # DB_HOST=localhost
9
- # DB_PORT=5432
10
- # DB_USER=postgres
11
- # DB_PASS=stevejobs
12
- # DB_NAME=CAA
8
+ DB_HOST=localhost
9
+ DB_PORT=5432
10
+ DB_USER=postgres
11
+ DB_PASS=stevejobs
12
+ DB_NAME=CAA
@@ -15,9 +15,10 @@ export declare enum OfficialPurposeOfTravel {
15
15
  Other = "Other"
16
16
  }
17
17
  export declare enum AccommodationType {
18
- Apartment = "Apartment",
19
- Villa = "Villa",
20
- SharedUnit = "Shared Unit"
18
+ Studio = "Studio",
19
+ OneRoom = "1 Room",
20
+ TwoRooms = "2 Rooms",
21
+ ThreeRooms = "3 Rooms"
21
22
  }
22
23
  export declare class AccommodationRequest extends BaseModel {
23
24
  reference_number: string | null;
@@ -32,6 +33,8 @@ export declare class AccommodationRequest extends BaseModel {
32
33
  other_purpose_specification: string | null;
33
34
  accommodation_type_requested: AccommodationType;
34
35
  start_date_of_stay: Date;
36
+ end_date_of_stay: Date;
37
+ departure_time: string;
35
38
  duration_of_days: number;
36
39
  travel_from: string;
37
40
  travel_to: string;
@@ -42,7 +45,7 @@ export declare class AccommodationRequest extends BaseModel {
42
45
  employee_id: string;
43
46
  employee_name: string;
44
47
  designation: string;
45
- grade: string;
48
+ grade?: string | null;
46
49
  contact_number: string;
47
50
  }>;
48
51
  status: AccommodationRequestStatus;
@@ -31,9 +31,10 @@ var OfficialPurposeOfTravel;
31
31
  })(OfficialPurposeOfTravel || (exports.OfficialPurposeOfTravel = OfficialPurposeOfTravel = {}));
32
32
  var AccommodationType;
33
33
  (function (AccommodationType) {
34
- AccommodationType["Apartment"] = "Apartment";
35
- AccommodationType["Villa"] = "Villa";
36
- AccommodationType["SharedUnit"] = "Shared Unit";
34
+ AccommodationType["Studio"] = "Studio";
35
+ AccommodationType["OneRoom"] = "1 Room";
36
+ AccommodationType["TwoRooms"] = "2 Rooms";
37
+ AccommodationType["ThreeRooms"] = "3 Rooms";
37
38
  })(AccommodationType || (exports.AccommodationType = AccommodationType = {}));
38
39
  let AccommodationRequest = class AccommodationRequest extends BaseModel_1.BaseModel {
39
40
  constructor() {
@@ -97,6 +98,14 @@ __decorate([
97
98
  (0, typeorm_1.Column)({ type: 'date', nullable: false }),
98
99
  __metadata("design:type", Date)
99
100
  ], AccommodationRequest.prototype, "start_date_of_stay", void 0);
101
+ __decorate([
102
+ (0, typeorm_1.Column)({ type: 'date', nullable: false }),
103
+ __metadata("design:type", Date)
104
+ ], AccommodationRequest.prototype, "end_date_of_stay", void 0);
105
+ __decorate([
106
+ (0, typeorm_1.Column)({ type: 'time', nullable: false }),
107
+ __metadata("design:type", String)
108
+ ], AccommodationRequest.prototype, "departure_time", void 0);
100
109
  __decorate([
101
110
  (0, typeorm_1.Column)({ type: 'int', nullable: false }),
102
111
  __metadata("design:type", Number)
@@ -0,0 +1,7 @@
1
+ import { BaseModel } from './BaseModel';
2
+ export declare class ITApprovalSettings extends BaseModel {
3
+ level: number;
4
+ approval_role_id: number;
5
+ workflow_id: number;
6
+ constructor(level: number, approval_role_id: number, workflow_id: number);
7
+ }
@@ -0,0 +1,40 @@
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.ITApprovalSettings = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ let ITApprovalSettings = class ITApprovalSettings extends BaseModel_1.BaseModel {
16
+ constructor(level, approval_role_id, workflow_id) {
17
+ super();
18
+ this.level = level;
19
+ this.approval_role_id = approval_role_id;
20
+ this.workflow_id = workflow_id;
21
+ }
22
+ };
23
+ exports.ITApprovalSettings = ITApprovalSettings;
24
+ __decorate([
25
+ (0, typeorm_1.Column)({ type: 'int', nullable: false }),
26
+ __metadata("design:type", Number)
27
+ ], ITApprovalSettings.prototype, "level", void 0);
28
+ __decorate([
29
+ (0, typeorm_1.Column)({ type: 'int', nullable: false }),
30
+ __metadata("design:type", Number)
31
+ ], ITApprovalSettings.prototype, "approval_role_id", void 0);
32
+ __decorate([
33
+ (0, typeorm_1.Column)({ type: 'int', nullable: false }),
34
+ __metadata("design:type", Number)
35
+ ], ITApprovalSettings.prototype, "workflow_id", void 0);
36
+ exports.ITApprovalSettings = ITApprovalSettings = __decorate([
37
+ (0, typeorm_1.Entity)({ name: 'it_approval_settings' }),
38
+ (0, typeorm_1.Unique)(['workflow_id', 'level']),
39
+ __metadata("design:paramtypes", [Number, Number, Number])
40
+ ], ITApprovalSettings);
@@ -0,0 +1,6 @@
1
+ import { BaseModel } from './BaseModel';
2
+ export declare class ITServicesTypesMuscat extends BaseModel {
3
+ name: string;
4
+ name_in_arabic: string;
5
+ constructor(name: string, name_in_arabic: string);
6
+ }
@@ -0,0 +1,34 @@
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.ITServicesTypesMuscat = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ let ITServicesTypesMuscat = class ITServicesTypesMuscat extends BaseModel_1.BaseModel {
16
+ constructor(name, name_in_arabic) {
17
+ super();
18
+ this.name = name;
19
+ this.name_in_arabic = name_in_arabic;
20
+ }
21
+ };
22
+ exports.ITServicesTypesMuscat = ITServicesTypesMuscat;
23
+ __decorate([
24
+ (0, typeorm_1.Column)({ nullable: false }),
25
+ __metadata("design:type", String)
26
+ ], ITServicesTypesMuscat.prototype, "name", void 0);
27
+ __decorate([
28
+ (0, typeorm_1.Column)({ nullable: false }),
29
+ __metadata("design:type", String)
30
+ ], ITServicesTypesMuscat.prototype, "name_in_arabic", void 0);
31
+ exports.ITServicesTypesMuscat = ITServicesTypesMuscat = __decorate([
32
+ (0, typeorm_1.Entity)({ name: 'it_services_types_muscat' }),
33
+ __metadata("design:paramtypes", [String, String])
34
+ ], ITServicesTypesMuscat);
@@ -0,0 +1,6 @@
1
+ import { BaseModel } from './BaseModel';
2
+ export declare class ITServicesTypesSalalah extends BaseModel {
3
+ name: string;
4
+ name_in_arabic: string;
5
+ constructor(name: string, name_in_arabic: string);
6
+ }
@@ -0,0 +1,34 @@
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.ITServicesTypesSalalah = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ let ITServicesTypesSalalah = class ITServicesTypesSalalah extends BaseModel_1.BaseModel {
16
+ constructor(name, name_in_arabic) {
17
+ super();
18
+ this.name = name;
19
+ this.name_in_arabic = name_in_arabic;
20
+ }
21
+ };
22
+ exports.ITServicesTypesSalalah = ITServicesTypesSalalah;
23
+ __decorate([
24
+ (0, typeorm_1.Column)({ nullable: false }),
25
+ __metadata("design:type", String)
26
+ ], ITServicesTypesSalalah.prototype, "name", void 0);
27
+ __decorate([
28
+ (0, typeorm_1.Column)({ nullable: false }),
29
+ __metadata("design:type", String)
30
+ ], ITServicesTypesSalalah.prototype, "name_in_arabic", void 0);
31
+ exports.ITServicesTypesSalalah = ITServicesTypesSalalah = __decorate([
32
+ (0, typeorm_1.Entity)({ name: 'it_services_types_salalah' }),
33
+ __metadata("design:paramtypes", [String, String])
34
+ ], ITServicesTypesSalalah);
@@ -5,16 +5,111 @@ export declare enum LegalComplaintRequestStatus {
5
5
  Rejected = "Rejected",
6
6
  RFC = "RFC"
7
7
  }
8
+ /** Step 2 — Complaint details (individuals, time, incident date, location, events, other details). */
9
+ export interface LegalComplaintIncidentInput {
10
+ incident_time?: string | null;
11
+ /** Date of the incident (step 2); distinct from request `complaint_date` / `date` on the body. */
12
+ incident_date?: string | null;
13
+ incident_location?: string | null;
14
+ individuals_involved?: string | null;
15
+ /** Events / narrative (UI “Events”). */
16
+ incident_events?: string | null;
17
+ /** “Any other details related to complaint”. */
18
+ incident_other_details?: string | null;
19
+ /** Optional combined narrative; if omitted, parser may derive from events + other_details. */
20
+ incident_description?: string;
21
+ }
22
+ /** Step 3 — Complainant: Name / Position / Employee ID / Directorate / Department / Section. */
23
+ export interface LegalComplaintComplainantInput {
24
+ name: string;
25
+ position?: string | null;
26
+ employee_id?: string | null;
27
+ directorate?: string | null;
28
+ department_id?: number | null;
29
+ section_id?: number | null;
30
+ /** When UI sends department as text instead of id. */
31
+ department_name?: string | null;
32
+ section_name?: string | null;
33
+ }
34
+ /** Step 4 — Subject of complaint: Name / Position / Salary grade / Directorate / Department / Section. */
35
+ export interface LegalComplaintSubjectEmployeeInput {
36
+ name: string;
37
+ position?: string | null;
38
+ salary_grade?: string | null;
39
+ directorate?: string | null;
40
+ department_id?: number | null;
41
+ section_id?: number | null;
42
+ department_name?: string | null;
43
+ section_name?: string | null;
44
+ }
45
+ export interface LegalComplaintStructuredCreateFields {
46
+ incident_time: string | null;
47
+ incident_date: string | null;
48
+ incident_location: string | null;
49
+ individuals_involved: string | null;
50
+ incident_events: string | null;
51
+ incident_other_details: string | null;
52
+ incident_description: string;
53
+ complainant_name: string;
54
+ complainant_position: string | null;
55
+ complainant_employee_id: string | null;
56
+ complainant_directorate: string | null;
57
+ complainant_department_id: number | null;
58
+ complainant_department_name: string | null;
59
+ complainant_section_id: number | null;
60
+ complainant_section_name: string | null;
61
+ complained_employee_name: string;
62
+ complained_employee_position: string | null;
63
+ complained_employee_salary_grade: string | null;
64
+ complained_employee_directorate: string | null;
65
+ complained_employee_department_id: number | null;
66
+ complained_employee_department_name: string | null;
67
+ complained_employee_section_id: number | null;
68
+ complained_employee_section_name: string | null;
69
+ }
70
+ export type LegalComplaintCreateFieldParseResult = {
71
+ ok: true;
72
+ fields: LegalComplaintStructuredCreateFields;
73
+ } | {
74
+ ok: false;
75
+ message: string;
76
+ };
77
+ /**
78
+ * Maps API / Conductor `requestData` to DB columns.
79
+ * Preferred: `complaint_incident`, `complainant`, `complained_employee` objects.
80
+ * Legacy: `complaint_details`, `complainant_details`, `complained_employee_details` non-empty strings.
81
+ */
82
+ export declare function parseLegalComplaintCreateFields(body: Record<string, any>): LegalComplaintCreateFieldParseResult;
8
83
  export declare class LegalComplaintRequest extends BaseModel {
9
84
  complaint_date: Date;
10
85
  title: string;
11
86
  description: string;
12
- /** Times, dates, locations, individuals, events, etc. */
13
- complaint_details: string;
14
- /** Name / Position / Employee ID / Directorate / Department / Section (structured text or JSON) */
15
- complainant_details: string;
16
- /** Subject of complaint: Name / Position / Salary Grade / Directorate / Department / Section */
17
- complained_employee_details: string;
87
+ incident_time: string | null;
88
+ incident_location: string | null;
89
+ individuals_involved: string | null;
90
+ /** Date of the incident (wizard step 2); request submission date remains `complaint_date`. */
91
+ incident_date: Date | null;
92
+ /** UI “Events”. */
93
+ incident_events: string | null;
94
+ /** “Any other details related to complaint”. */
95
+ incident_other_details: string | null;
96
+ incident_description: string;
97
+ complainant_name: string;
98
+ complainant_position: string | null;
99
+ complainant_employee_id: string | null;
100
+ complainant_directorate: string | null;
101
+ complainant_department_id: number | null;
102
+ complainant_department_name: string | null;
103
+ complainant_section_id: number | null;
104
+ complainant_section_name: string | null;
105
+ complained_employee_name: string;
106
+ complained_employee_position: string | null;
107
+ complained_employee_salary_grade: string | null;
108
+ complained_employee_directorate: string | null;
109
+ complained_employee_department_id: number | null;
110
+ complained_employee_department_name: string | null;
111
+ complained_employee_section_id: number | null;
112
+ complained_employee_section_name: string | null;
18
113
  req_user_department_id: number | null;
19
114
  req_user_section_id: number | null;
20
115
  status: string;
@@ -10,6 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.LegalComplaintRequest = exports.LegalComplaintRequestStatus = void 0;
13
+ exports.parseLegalComplaintCreateFields = parseLegalComplaintCreateFields;
13
14
  const typeorm_1 = require("typeorm");
14
15
  const BaseModel_1 = require("./BaseModel");
15
16
  var LegalComplaintRequestStatus;
@@ -19,6 +20,177 @@ var LegalComplaintRequestStatus;
19
20
  LegalComplaintRequestStatus["Rejected"] = "Rejected";
20
21
  LegalComplaintRequestStatus["RFC"] = "RFC";
21
22
  })(LegalComplaintRequestStatus || (exports.LegalComplaintRequestStatus = LegalComplaintRequestStatus = {}));
23
+ function pickStr(v) {
24
+ if (v == null || v === '')
25
+ return null;
26
+ const s = String(v).trim();
27
+ return s === '' ? null : s;
28
+ }
29
+ function pickNum(v) {
30
+ if (v == null || v === '')
31
+ return null;
32
+ const n = Number(v);
33
+ return Number.isFinite(n) && n > 0 ? Math.floor(n) : null;
34
+ }
35
+ /** YYYY-MM-DD or parseable date string; returns null if invalid. */
36
+ function pickDateOnlyStr(v) {
37
+ if (v == null || v === '')
38
+ return null;
39
+ const s = String(v).trim();
40
+ const iso = s.match(/^(\d{4}-\d{2}-\d{2})/);
41
+ if (iso)
42
+ return iso[1];
43
+ const d = new Date(s);
44
+ if (Number.isNaN(d.getTime()))
45
+ return null;
46
+ return d.toISOString().slice(0, 10);
47
+ }
48
+ function pickDepartmentSectionNames(obj, idKey, altIdKey, nameKey, plainKey) {
49
+ let id = pickNum(obj[idKey] ?? obj[altIdKey]);
50
+ let name = pickStr(obj[nameKey]);
51
+ const plain = obj[plainKey];
52
+ if (plain != null && plain !== '') {
53
+ if (typeof plain === 'number' || (typeof plain === 'string' && /^\d+$/.test(String(plain).trim()))) {
54
+ const n = pickNum(plain);
55
+ if (n != null && id == null)
56
+ id = n;
57
+ }
58
+ else {
59
+ const ps = pickStr(plain);
60
+ if (ps)
61
+ name = name || ps;
62
+ }
63
+ }
64
+ return { id, name };
65
+ }
66
+ /**
67
+ * Maps API / Conductor `requestData` to DB columns.
68
+ * Preferred: `complaint_incident`, `complainant`, `complained_employee` objects.
69
+ * Legacy: `complaint_details`, `complainant_details`, `complained_employee_details` non-empty strings.
70
+ */
71
+ function parseLegalComplaintCreateFields(body) {
72
+ const legacyComplaint = body.complaint_details;
73
+ const legacyComplainant = body.complainant_details;
74
+ const legacySubject = body.complained_employee_details;
75
+ const inc = body.complaint_incident ?? body.complaintIncident;
76
+ let incident_time = null;
77
+ let incident_date = null;
78
+ let incident_location = null;
79
+ let individuals_involved = null;
80
+ let incident_events = null;
81
+ let incident_other_details = null;
82
+ let incident_description = '';
83
+ if (typeof legacyComplaint === 'string' && legacyComplaint.trim() !== '' && (inc == null || typeof inc !== 'object')) {
84
+ incident_description = legacyComplaint.trim();
85
+ }
86
+ else if (inc != null && typeof inc === 'object' && !Array.isArray(inc)) {
87
+ incident_time = pickStr(inc.incident_time ?? inc.time);
88
+ incident_date = pickDateOnlyStr(inc.incident_date ?? inc.date_of_incident);
89
+ incident_location = pickStr(inc.incident_location ?? inc.location);
90
+ individuals_involved = pickStr(inc.individuals_involved ?? inc.persons_involved);
91
+ incident_events = pickStr(inc.incident_events ?? inc.events);
92
+ incident_other_details = pickStr(inc.incident_other_details ?? inc.other_details ?? inc.any_other_details_related_to_complaint);
93
+ incident_description = String(inc.incident_description ?? inc.description ?? '').trim();
94
+ if (!incident_description) {
95
+ const parts = [incident_events, incident_other_details].filter((x) => x && String(x).trim());
96
+ incident_description = parts.join('\n\n').trim();
97
+ }
98
+ }
99
+ if (!incident_description) {
100
+ return {
101
+ ok: false,
102
+ message: 'complaint_incident must include incident_description, or incident_events / incident_other_details, or legacy complaint_details text',
103
+ };
104
+ }
105
+ const comp = body.complainant;
106
+ let complainant_name = '';
107
+ let complainant_position = null;
108
+ let complainant_employee_id = null;
109
+ let complainant_directorate = null;
110
+ let complainant_department_id = null;
111
+ let complainant_department_name = null;
112
+ let complainant_section_id = null;
113
+ let complainant_section_name = null;
114
+ if (typeof legacyComplainant === 'string' && legacyComplainant.trim() !== '' && (comp == null || typeof comp !== 'object')) {
115
+ complainant_name = legacyComplainant.trim();
116
+ }
117
+ else if (comp != null && typeof comp === 'object' && !Array.isArray(comp)) {
118
+ complainant_name = String(comp.name ?? '').trim();
119
+ complainant_position = pickStr(comp.position);
120
+ complainant_employee_id = pickStr(comp.employee_id ?? comp.employeeId);
121
+ complainant_directorate = pickStr(comp.directorate);
122
+ const dep = pickDepartmentSectionNames(comp, 'department_id', 'departmentId', 'department_name', 'department');
123
+ const sec = pickDepartmentSectionNames(comp, 'section_id', 'sectionId', 'section_name', 'section');
124
+ complainant_department_id = dep.id;
125
+ complainant_department_name = dep.name;
126
+ complainant_section_id = sec.id;
127
+ complainant_section_name = sec.name;
128
+ }
129
+ if (!complainant_name) {
130
+ return {
131
+ ok: false,
132
+ message: 'complainant.name is required (or legacy complainant_details text)',
133
+ };
134
+ }
135
+ const sub = body.complained_employee ?? body.complainedEmployee;
136
+ let complained_employee_name = '';
137
+ let complained_employee_position = null;
138
+ let complained_employee_salary_grade = null;
139
+ let complained_employee_directorate = null;
140
+ let complained_employee_department_id = null;
141
+ let complained_employee_department_name = null;
142
+ let complained_employee_section_id = null;
143
+ let complained_employee_section_name = null;
144
+ if (typeof legacySubject === 'string' && legacySubject.trim() !== '' && (sub == null || typeof sub !== 'object')) {
145
+ complained_employee_name = legacySubject.trim();
146
+ }
147
+ else if (sub != null && typeof sub === 'object' && !Array.isArray(sub)) {
148
+ complained_employee_name = String(sub.name ?? '').trim();
149
+ complained_employee_position = pickStr(sub.position);
150
+ complained_employee_salary_grade = pickStr(sub.salary_grade ?? sub.salaryGrade);
151
+ complained_employee_directorate = pickStr(sub.directorate);
152
+ const dep = pickDepartmentSectionNames(sub, 'department_id', 'departmentId', 'department_name', 'department');
153
+ const sec = pickDepartmentSectionNames(sub, 'section_id', 'sectionId', 'section_name', 'section');
154
+ complained_employee_department_id = dep.id;
155
+ complained_employee_department_name = dep.name;
156
+ complained_employee_section_id = sec.id;
157
+ complained_employee_section_name = sec.name;
158
+ }
159
+ if (!complained_employee_name) {
160
+ return {
161
+ ok: false,
162
+ message: 'complained_employee.name is required (or legacy complained_employee_details text)',
163
+ };
164
+ }
165
+ return {
166
+ ok: true,
167
+ fields: {
168
+ incident_time,
169
+ incident_date,
170
+ incident_location,
171
+ individuals_involved,
172
+ incident_events,
173
+ incident_other_details,
174
+ incident_description,
175
+ complainant_name,
176
+ complainant_position,
177
+ complainant_employee_id,
178
+ complainant_directorate,
179
+ complainant_department_id,
180
+ complainant_department_name,
181
+ complainant_section_id,
182
+ complainant_section_name,
183
+ complained_employee_name,
184
+ complained_employee_position,
185
+ complained_employee_salary_grade,
186
+ complained_employee_directorate,
187
+ complained_employee_department_id,
188
+ complained_employee_department_name,
189
+ complained_employee_section_id,
190
+ complained_employee_section_name,
191
+ },
192
+ };
193
+ }
22
194
  let LegalComplaintRequest = class LegalComplaintRequest extends BaseModel_1.BaseModel {
23
195
  constructor() {
24
196
  super();
@@ -37,18 +209,98 @@ __decorate([
37
209
  (0, typeorm_1.Column)({ type: 'text', nullable: false }),
38
210
  __metadata("design:type", String)
39
211
  ], LegalComplaintRequest.prototype, "description", void 0);
212
+ __decorate([
213
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
214
+ __metadata("design:type", Object)
215
+ ], LegalComplaintRequest.prototype, "incident_time", void 0);
216
+ __decorate([
217
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
218
+ __metadata("design:type", Object)
219
+ ], LegalComplaintRequest.prototype, "incident_location", void 0);
220
+ __decorate([
221
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
222
+ __metadata("design:type", Object)
223
+ ], LegalComplaintRequest.prototype, "individuals_involved", void 0);
224
+ __decorate([
225
+ (0, typeorm_1.Column)({ type: 'date', nullable: true }),
226
+ __metadata("design:type", Object)
227
+ ], LegalComplaintRequest.prototype, "incident_date", void 0);
228
+ __decorate([
229
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
230
+ __metadata("design:type", Object)
231
+ ], LegalComplaintRequest.prototype, "incident_events", void 0);
232
+ __decorate([
233
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
234
+ __metadata("design:type", Object)
235
+ ], LegalComplaintRequest.prototype, "incident_other_details", void 0);
40
236
  __decorate([
41
237
  (0, typeorm_1.Column)({ type: 'text', nullable: false }),
42
238
  __metadata("design:type", String)
43
- ], LegalComplaintRequest.prototype, "complaint_details", void 0);
239
+ ], LegalComplaintRequest.prototype, "incident_description", void 0);
44
240
  __decorate([
45
- (0, typeorm_1.Column)({ type: 'text', nullable: false }),
241
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: false }),
46
242
  __metadata("design:type", String)
47
- ], LegalComplaintRequest.prototype, "complainant_details", void 0);
243
+ ], LegalComplaintRequest.prototype, "complainant_name", void 0);
48
244
  __decorate([
49
- (0, typeorm_1.Column)({ type: 'text', nullable: false }),
245
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
246
+ __metadata("design:type", Object)
247
+ ], LegalComplaintRequest.prototype, "complainant_position", void 0);
248
+ __decorate([
249
+ (0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
250
+ __metadata("design:type", Object)
251
+ ], LegalComplaintRequest.prototype, "complainant_employee_id", void 0);
252
+ __decorate([
253
+ (0, typeorm_1.Column)({ type: 'varchar', length: 500, nullable: true }),
254
+ __metadata("design:type", Object)
255
+ ], LegalComplaintRequest.prototype, "complainant_directorate", void 0);
256
+ __decorate([
257
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
258
+ __metadata("design:type", Object)
259
+ ], LegalComplaintRequest.prototype, "complainant_department_id", void 0);
260
+ __decorate([
261
+ (0, typeorm_1.Column)({ type: 'varchar', length: 500, nullable: true }),
262
+ __metadata("design:type", Object)
263
+ ], LegalComplaintRequest.prototype, "complainant_department_name", void 0);
264
+ __decorate([
265
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
266
+ __metadata("design:type", Object)
267
+ ], LegalComplaintRequest.prototype, "complainant_section_id", void 0);
268
+ __decorate([
269
+ (0, typeorm_1.Column)({ type: 'varchar', length: 500, nullable: true }),
270
+ __metadata("design:type", Object)
271
+ ], LegalComplaintRequest.prototype, "complainant_section_name", void 0);
272
+ __decorate([
273
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: false }),
50
274
  __metadata("design:type", String)
51
- ], LegalComplaintRequest.prototype, "complained_employee_details", void 0);
275
+ ], LegalComplaintRequest.prototype, "complained_employee_name", void 0);
276
+ __decorate([
277
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
278
+ __metadata("design:type", Object)
279
+ ], LegalComplaintRequest.prototype, "complained_employee_position", void 0);
280
+ __decorate([
281
+ (0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
282
+ __metadata("design:type", Object)
283
+ ], LegalComplaintRequest.prototype, "complained_employee_salary_grade", void 0);
284
+ __decorate([
285
+ (0, typeorm_1.Column)({ type: 'varchar', length: 500, nullable: true }),
286
+ __metadata("design:type", Object)
287
+ ], LegalComplaintRequest.prototype, "complained_employee_directorate", void 0);
288
+ __decorate([
289
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
290
+ __metadata("design:type", Object)
291
+ ], LegalComplaintRequest.prototype, "complained_employee_department_id", void 0);
292
+ __decorate([
293
+ (0, typeorm_1.Column)({ type: 'varchar', length: 500, nullable: true }),
294
+ __metadata("design:type", Object)
295
+ ], LegalComplaintRequest.prototype, "complained_employee_department_name", void 0);
296
+ __decorate([
297
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
298
+ __metadata("design:type", Object)
299
+ ], LegalComplaintRequest.prototype, "complained_employee_section_id", void 0);
300
+ __decorate([
301
+ (0, typeorm_1.Column)({ type: 'varchar', length: 500, nullable: true }),
302
+ __metadata("design:type", Object)
303
+ ], LegalComplaintRequest.prototype, "complained_employee_section_name", void 0);
52
304
  __decorate([
53
305
  (0, typeorm_1.Column)({ type: 'int', nullable: true }),
54
306
  __metadata("design:type", Object)
@@ -0,0 +1,9 @@
1
+ import { BaseModel } from './BaseModel';
2
+ export declare class Workflows extends BaseModel {
3
+ name: string;
4
+ service_id: number;
5
+ sub_service_id: number;
6
+ request_for: string;
7
+ levels: number;
8
+ constructor(name: string, service_id: number, sub_service_id: number, request_for: string, levels: number);
9
+ }