@platform-modules/foreign-ministry 1.3.333 → 1.3.335

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 (32) hide show
  1. package/.env +10 -10
  2. package/dist/helpers/services-notification-config.helper.js +2 -6
  3. package/dist/helpers/sla-request-status.helper.d.ts +3 -0
  4. package/dist/helpers/sla-request-status.helper.js +36 -0
  5. package/dist/models/CityMasterModel.d.ts +1 -0
  6. package/dist/models/CityMasterModel.js +4 -0
  7. package/dist/models/DepartmentsModel.d.ts +1 -0
  8. package/dist/models/DepartmentsModel.js +4 -0
  9. package/dist/models/DiplomaticTitlesMasterModel.d.ts +1 -0
  10. package/dist/models/DiplomaticTitlesMasterModel.js +4 -0
  11. package/dist/models/GroupNamesModel.d.ts +1 -0
  12. package/dist/models/GroupNamesModel.js +4 -0
  13. package/dist/models/LocationModel.d.ts +1 -0
  14. package/dist/models/LocationModel.js +4 -0
  15. package/dist/models/SectionModel.d.ts +1 -0
  16. package/dist/models/SectionModel.js +4 -0
  17. package/dist/models/SlaRequestModel.d.ts +4 -2
  18. package/dist/models/SlaRequestModel.js +4 -2
  19. package/dist/models/role.d.ts +2 -1
  20. package/dist/models/role.js +7 -2
  21. package/package.json +35 -35
  22. package/sql/sla-reports-sync.manifest.json +1 -0
  23. package/sql/sla_requests_status_to_varchar.sql +28 -0
  24. package/src/helpers/services-notification-config.helper.ts +1 -6
  25. package/src/models/CityMasterModel.ts +3 -0
  26. package/src/models/DepartmentsModel.ts +3 -0
  27. package/src/models/DiplomaticTitlesMasterModel.ts +3 -0
  28. package/src/models/GroupNamesModel.ts +3 -0
  29. package/src/models/LocationModel.ts +3 -0
  30. package/src/models/SectionModel.ts +38 -35
  31. package/src/models/SlaRequestModel.ts +57 -55
  32. package/src/models/role.ts +7 -3
package/.env CHANGED
@@ -1,10 +1,10 @@
1
- # DB_HOST=localhost
2
- # DB_PORT=5432
3
- # DB_USER=postgres
4
- # DB_PASS=stevejobs
5
- # DB_NAME=FM
6
-
7
- DB_HOST = 164.52.222.169
8
- DB_USER = postgres_admin_user
9
- DB_PASS = pg_admin_user_pwd_caa_fa_$%^&OIukhjgcvbn
10
- DB_NAME=FM
1
+ # DB_HOST=localhost
2
+ # DB_PORT=5432
3
+ # DB_USER=postgres
4
+ # DB_PASS=stevejobs
5
+ # DB_NAME=FM
6
+
7
+ DB_HOST = 164.52.222.169
8
+ DB_USER = postgres_admin_user
9
+ DB_PASS = pg_admin_user_pwd_caa_fa_$%^&OIukhjgcvbn
10
+ DB_NAME=FM
@@ -80,7 +80,7 @@ async function collectFmServicesNotificationConfigRecipients(manager, params) {
80
80
  * Inserts portal notifications for users resolved from `services_notification_configs`.
81
81
  */
82
82
  async function sendFmServicesNotificationConfigNotifications(manager, params) {
83
- const { serviceId, subServiceId, pendingCount, requestId, status, approvalLevel, shortProductName, requestTypeKey, routePath, createdBy, logPrefix = '[FM notification config]', } = params;
83
+ const { serviceId, subServiceId, pendingCount, requestId, status, shortProductName, requestTypeKey, routePath, createdBy, logPrefix = '[FM notification config]', } = params;
84
84
  if (!serviceId || !subServiceId)
85
85
  return { sentCount: 0 };
86
86
  const notificationConfigs = await manager
@@ -126,10 +126,7 @@ async function sendFmServicesNotificationConfigNotifications(manager, params) {
126
126
  console.warn(`${logPrefix} No users found for ${notificationConfig.trigger} config (dept ${notificationConfig.department_id}${notificationConfig.section_id != null ? `, section ${notificationConfig.section_id}` : ''})`);
127
127
  continue;
128
128
  }
129
- const isEveryApproval = notificationConfig.trigger === ServicesNotificationConfigsModel_1.ServicesNotificationTriggerType.EVERY_APPROVAL;
130
- const notificationTitle = isEveryApproval
131
- ? `${shortProductName} Request ${status} at Level ${approvalLevel}`
132
- : `${shortProductName} Request ${status}`;
129
+ const notificationTitle = `${shortProductName} Request ${status}`;
133
130
  const notificationData = `${shortProductName} request #${requestId} has been ${status}.`;
134
131
  for (const ur of userRoles) {
135
132
  const targetUserId = ur.user_id;
@@ -160,7 +157,6 @@ async function sendFmServicesNotificationConfigNotifications(manager, params) {
160
157
  requestId,
161
158
  requestType: requestTypeKey,
162
159
  status,
163
- level: approvalLevel,
164
160
  timestamp: new Date().toISOString(),
165
161
  },
166
162
  is_read: false,
@@ -0,0 +1,3 @@
1
+ export declare function resolveSlaRequestStatusFromNative(nativeStatus: unknown, fallback?: string): string;
2
+ /** Maps portal/native request status to a value stored on `sla_requests.status`. */
3
+ export declare function mapPortalRequestStatusToSla(status: string): string | null;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveSlaRequestStatusFromNative = resolveSlaRequestStatusFromNative;
4
+ exports.mapPortalRequestStatusToSla = mapPortalRequestStatusToSla;
5
+ const SlaRequestModel_1 = require("../models/SlaRequestModel");
6
+ const SLA_MIRROR_STATUS_CANONICAL = {
7
+ pending: SlaRequestModel_1.SlaRequestStatus.PENDING,
8
+ "in progress": SlaRequestModel_1.SlaRequestStatus.IN_PROGRESS,
9
+ approved: SlaRequestModel_1.SlaRequestStatus.APPROVED,
10
+ rejected: SlaRequestModel_1.SlaRequestStatus.REJECTED,
11
+ assigned: SlaRequestModel_1.SlaRequestStatus.ASSIGNED,
12
+ completed: SlaRequestModel_1.SlaRequestStatus.COMPLETED,
13
+ closed: "Closed",
14
+ returned: "Returned",
15
+ rfc: "RFC",
16
+ "request for change": "Request For Change"
17
+ };
18
+ function resolveSlaRequestStatusFromNative(nativeStatus, fallback = SlaRequestModel_1.SlaRequestStatus.PENDING) {
19
+ const trimmed = String(nativeStatus ?? "").trim();
20
+ if (!trimmed) {
21
+ return fallback;
22
+ }
23
+ const canonical = SLA_MIRROR_STATUS_CANONICAL[trimmed.toLowerCase()];
24
+ return canonical ?? trimmed;
25
+ }
26
+ /** Maps portal/native request status to a value stored on `sla_requests.status`. */
27
+ function mapPortalRequestStatusToSla(status) {
28
+ const resolved = resolveSlaRequestStatusFromNative(status, "");
29
+ if (!resolved) {
30
+ return null;
31
+ }
32
+ if (String(status || "").trim().toLowerCase() === "cancelled") {
33
+ return SlaRequestModel_1.SlaRequestStatus.REJECTED;
34
+ }
35
+ return resolved;
36
+ }
@@ -2,6 +2,7 @@ import { BaseModel } from './BaseModel';
2
2
  export declare class CityMaster extends BaseModel {
3
3
  country_id: number | null;
4
4
  city_name: string;
5
+ city_arabic_name: string | null;
5
6
  city_code: string | null;
6
7
  description: string | null;
7
8
  constructor(city_name: string);
@@ -27,6 +27,10 @@ __decorate([
27
27
  (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: false }),
28
28
  __metadata("design:type", String)
29
29
  ], CityMaster.prototype, "city_name", void 0);
30
+ __decorate([
31
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
32
+ __metadata("design:type", Object)
33
+ ], CityMaster.prototype, "city_arabic_name", void 0);
30
34
  __decorate([
31
35
  (0, typeorm_1.Column)({ type: 'varchar', length: 50, nullable: true }),
32
36
  __metadata("design:type", Object)
@@ -1,6 +1,7 @@
1
1
  import { BaseModel } from './BaseModel';
2
2
  export declare class Departments extends BaseModel {
3
3
  department_name: string;
4
+ department_arabic_name: string | null;
4
5
  department_code: string;
5
6
  department_description: string;
6
7
  undersecretary_department_id: number | null;
@@ -27,6 +27,10 @@ __decorate([
27
27
  (0, typeorm_1.Column)({ type: 'varchar', length: 64, nullable: false }),
28
28
  __metadata("design:type", String)
29
29
  ], Departments.prototype, "department_name", void 0);
30
+ __decorate([
31
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
32
+ __metadata("design:type", Object)
33
+ ], Departments.prototype, "department_arabic_name", void 0);
30
34
  __decorate([
31
35
  (0, typeorm_1.Column)({ type: 'varchar', length: 64, nullable: false }),
32
36
  __metadata("design:type", String)
@@ -5,6 +5,7 @@ export declare enum TitleCategory {
5
5
  }
6
6
  export declare class DiplomaticTitlesMaster extends BaseModel {
7
7
  title: string;
8
+ diplomatic_title_arabic_name: string | null;
8
9
  category: TitleCategory;
9
10
  constructor(title: string, category: TitleCategory);
10
11
  }
@@ -29,6 +29,10 @@ __decorate([
29
29
  (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: false }),
30
30
  __metadata("design:type", String)
31
31
  ], DiplomaticTitlesMaster.prototype, "title", void 0);
32
+ __decorate([
33
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
34
+ __metadata("design:type", Object)
35
+ ], DiplomaticTitlesMaster.prototype, "diplomatic_title_arabic_name", void 0);
32
36
  __decorate([
33
37
  (0, typeorm_1.Column)({ type: 'enum', enum: TitleCategory, nullable: false, default: TitleCategory.EMPLOYEE }),
34
38
  __metadata("design:type", String)
@@ -1,6 +1,7 @@
1
1
  import { BaseModel } from './BaseModel';
2
2
  export declare class GroupNames extends BaseModel {
3
3
  name: string;
4
+ group_arabic_name: string | null;
4
5
  description: string;
5
6
  constructor(name: string, description: string);
6
7
  }
@@ -24,6 +24,10 @@ __decorate([
24
24
  (0, typeorm_1.Column)({ nullable: false }),
25
25
  __metadata("design:type", String)
26
26
  ], GroupNames.prototype, "name", void 0);
27
+ __decorate([
28
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
29
+ __metadata("design:type", Object)
30
+ ], GroupNames.prototype, "group_arabic_name", void 0);
27
31
  __decorate([
28
32
  (0, typeorm_1.Column)({ nullable: true }),
29
33
  __metadata("design:type", String)
@@ -1,6 +1,7 @@
1
1
  export declare class Location {
2
2
  id: number;
3
3
  name: string;
4
+ location_arabic_name: string | null;
4
5
  description: string;
5
6
  is_active: boolean;
6
7
  is_deleted: boolean;
@@ -28,6 +28,10 @@ __decorate([
28
28
  (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: false }),
29
29
  __metadata("design:type", String)
30
30
  ], Location.prototype, "name", void 0);
31
+ __decorate([
32
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
33
+ __metadata("design:type", Object)
34
+ ], Location.prototype, "location_arabic_name", void 0);
31
35
  __decorate([
32
36
  (0, typeorm_1.Column)({ type: 'text', nullable: true }),
33
37
  __metadata("design:type", String)
@@ -1,6 +1,7 @@
1
1
  import { BaseModel } from './BaseModel';
2
2
  export declare class Sections extends BaseModel {
3
3
  section_name: string;
4
+ section_arabic_name: string | null;
4
5
  section_code: string;
5
6
  section_description: string;
6
7
  department_id: number;
@@ -27,6 +27,10 @@ __decorate([
27
27
  (0, typeorm_1.Column)({ type: 'varchar', length: 64, nullable: false }),
28
28
  __metadata("design:type", String)
29
29
  ], Sections.prototype, "section_name", void 0);
30
+ __decorate([
31
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
32
+ __metadata("design:type", Object)
33
+ ], Sections.prototype, "section_arabic_name", void 0);
30
34
  __decorate([
31
35
  (0, typeorm_1.Column)({ type: 'varchar', length: 64, nullable: false }),
32
36
  __metadata("design:type", String)
@@ -3,7 +3,9 @@ export declare enum SlaRequestStatus {
3
3
  PENDING = "Pending",
4
4
  IN_PROGRESS = "In Progress",
5
5
  APPROVED = "Approved",
6
- REJECTED = "Rejected"
6
+ REJECTED = "Rejected",
7
+ ASSIGNED = "Assigned",
8
+ COMPLETED = "Completed"
7
9
  }
8
10
  export declare class SlaRequest extends BaseModel {
9
11
  req_user_department_id: number | null;
@@ -11,7 +13,7 @@ export declare class SlaRequest extends BaseModel {
11
13
  service_id: number | null;
12
14
  sub_service_id: number | null;
13
15
  user_id: number;
14
- status: SlaRequestStatus;
16
+ status: string;
15
17
  workflow_execution_id: string | null;
16
18
  request_id: number;
17
19
  request_obj: Record<string, unknown>;
@@ -18,6 +18,8 @@ var SlaRequestStatus;
18
18
  SlaRequestStatus["IN_PROGRESS"] = "In Progress";
19
19
  SlaRequestStatus["APPROVED"] = "Approved";
20
20
  SlaRequestStatus["REJECTED"] = "Rejected";
21
+ SlaRequestStatus["ASSIGNED"] = "Assigned";
22
+ SlaRequestStatus["COMPLETED"] = "Completed";
21
23
  })(SlaRequestStatus || (exports.SlaRequestStatus = SlaRequestStatus = {}));
22
24
  let SlaRequest = class SlaRequest extends BaseModel_1.BaseModel {
23
25
  constructor() {
@@ -49,8 +51,8 @@ __decorate([
49
51
  ], SlaRequest.prototype, "user_id", void 0);
50
52
  __decorate([
51
53
  (0, typeorm_1.Column)({
52
- type: "enum",
53
- enum: SlaRequestStatus,
54
+ type: "varchar",
55
+ length: 64,
54
56
  default: SlaRequestStatus.PENDING,
55
57
  nullable: false
56
58
  }),
@@ -11,6 +11,7 @@ Userrole Information will store
11
11
  import { BaseModel } from './BaseModel';
12
12
  export declare class Role extends BaseModel {
13
13
  name: string;
14
+ arabic_name: string | null;
14
15
  is_deleted?: boolean;
15
- constructor(name: string, is_deleted: boolean);
16
+ constructor(name: string, is_deleted: boolean, arabic_name?: string | null);
16
17
  }
@@ -23,10 +23,11 @@ exports.Role = void 0;
23
23
  const typeorm_1 = require("typeorm");
24
24
  const BaseModel_1 = require("./BaseModel");
25
25
  let Role = class Role extends BaseModel_1.BaseModel {
26
- constructor(name, is_deleted) {
26
+ constructor(name, is_deleted, arabic_name = null) {
27
27
  super();
28
28
  this.name = name;
29
29
  this.is_deleted = is_deleted;
30
+ this.arabic_name = arabic_name;
30
31
  }
31
32
  };
32
33
  exports.Role = Role;
@@ -34,11 +35,15 @@ __decorate([
34
35
  (0, typeorm_1.Column)({ nullable: true }),
35
36
  __metadata("design:type", String)
36
37
  ], Role.prototype, "name", void 0);
38
+ __decorate([
39
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
40
+ __metadata("design:type", Object)
41
+ ], Role.prototype, "arabic_name", void 0);
37
42
  __decorate([
38
43
  (0, typeorm_1.Column)({ nullable: true }),
39
44
  __metadata("design:type", Boolean)
40
45
  ], Role.prototype, "is_deleted", void 0);
41
46
  exports.Role = Role = __decorate([
42
47
  (0, typeorm_1.Entity)({ name: 'role' }),
43
- __metadata("design:paramtypes", [String, Boolean])
48
+ __metadata("design:paramtypes", [String, Boolean, Object])
44
49
  ], Role);
package/package.json CHANGED
@@ -1,35 +1,35 @@
1
- {
2
- "name": "@platform-modules/foreign-ministry",
3
- "version": "1.3.333",
4
- "main": "dist/index.js",
5
- "types": "dist/index.d.ts",
6
- "exports": {
7
- ".": {
8
- "types": "./dist/index.d.ts",
9
- "default": "./dist/index.js"
10
- },
11
- "./sla-report-views": {
12
- "types": "./dist/sla-report-views.d.ts",
13
- "default": "./dist/sla-report-views.js"
14
- }
15
- },
16
- "scripts": {
17
- "build": "tsc",
18
- "dev": "ts-node src/scripts.ts",
19
- "sync:sla-sql": "node scripts/sync-sla-reports-sql.js"
20
- },
21
- "publishConfig": {
22
- "access": "public"
23
- },
24
- "dependencies": {
25
- "moment-timezone": "^0.6.0",
26
- "pg": "^8.16.0",
27
- "typeorm": "^0.3.17"
28
- },
29
- "devDependencies": {
30
- "@types/moment-timezone": "^0.5.30",
31
- "dotenv": "^16.5.0",
32
- "ts-node": "^10.9.2",
33
- "typescript": "^5.2.0"
34
- }
35
- }
1
+ {
2
+ "name": "@platform-modules/foreign-ministry",
3
+ "version": "1.3.335",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "default": "./dist/index.js"
10
+ },
11
+ "./sla-report-views": {
12
+ "types": "./dist/sla-report-views.d.ts",
13
+ "default": "./dist/sla-report-views.js"
14
+ }
15
+ },
16
+ "scripts": {
17
+ "build": "tsc",
18
+ "dev": "ts-node src/scripts.ts",
19
+ "sync:sla-sql": "node scripts/sync-sla-reports-sql.js"
20
+ },
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "dependencies": {
25
+ "moment-timezone": "^0.6.0",
26
+ "pg": "^8.16.0",
27
+ "typeorm": "^0.3.17"
28
+ },
29
+ "devDependencies": {
30
+ "@types/moment-timezone": "^0.5.30",
31
+ "dotenv": "^16.5.0",
32
+ "ts-node": "^10.9.2",
33
+ "typescript": "^5.2.0"
34
+ }
35
+ }
@@ -1,4 +1,5 @@
1
1
  [
2
+ "sla_requests_status_to_varchar.sql",
2
3
  "vw_sla_my_requests.sql",
3
4
  "vw_sla_approvals.sql",
4
5
  "sla_reports_procedures.sql",
@@ -0,0 +1,28 @@
1
+ -- Store sla_requests.status as varchar (not enum) so Assigned / Completed and future values work without enum migrations.
2
+
3
+ DO $$
4
+ BEGIN
5
+ IF EXISTS (
6
+ SELECT 1
7
+ FROM information_schema.columns
8
+ WHERE table_schema = 'public'
9
+ AND table_name = 'sla_requests'
10
+ AND column_name = 'status'
11
+ AND udt_name = 'sla_requests_status_enum'
12
+ ) THEN
13
+ ALTER TABLE sla_requests
14
+ ALTER COLUMN status TYPE varchar(64) USING status::text;
15
+ ELSIF EXISTS (
16
+ SELECT 1
17
+ FROM information_schema.columns
18
+ WHERE table_schema = 'public'
19
+ AND table_name = 'sla_requests'
20
+ AND column_name = 'status'
21
+ AND character_maximum_length IS DISTINCT FROM 64
22
+ ) THEN
23
+ ALTER TABLE sla_requests
24
+ ALTER COLUMN status TYPE varchar(64) USING status::text;
25
+ END IF;
26
+ END $$;
27
+
28
+
@@ -133,7 +133,6 @@ export async function sendFmServicesNotificationConfigNotifications(
133
133
  pendingCount,
134
134
  requestId,
135
135
  status,
136
- approvalLevel,
137
136
  shortProductName,
138
137
  requestTypeKey,
139
138
  routePath,
@@ -194,10 +193,7 @@ export async function sendFmServicesNotificationConfigNotifications(
194
193
  continue;
195
194
  }
196
195
 
197
- const isEveryApproval = notificationConfig.trigger === ServicesNotificationTriggerType.EVERY_APPROVAL;
198
- const notificationTitle = isEveryApproval
199
- ? `${shortProductName} Request ${status} at Level ${approvalLevel}`
200
- : `${shortProductName} Request ${status}`;
196
+ const notificationTitle = `${shortProductName} Request ${status}`;
201
197
  const notificationData = `${shortProductName} request #${requestId} has been ${status}.`;
202
198
 
203
199
  for (const ur of userRoles) {
@@ -230,7 +226,6 @@ export async function sendFmServicesNotificationConfigNotifications(
230
226
  requestId,
231
227
  requestType: requestTypeKey,
232
228
  status,
233
- level: approvalLevel,
234
229
  timestamp: new Date().toISOString(),
235
230
  },
236
231
  is_read: false,
@@ -9,6 +9,9 @@ export class CityMaster extends BaseModel {
9
9
  @Column({ type: 'varchar', length: 255, nullable: false })
10
10
  city_name: string;
11
11
 
12
+ @Column({ type: 'varchar', length: 255, nullable: true })
13
+ city_arabic_name: string | null;
14
+
12
15
  @Column({ type: 'varchar', length: 50, nullable: true })
13
16
  city_code: string | null;
14
17
 
@@ -7,6 +7,9 @@ export class Departments extends BaseModel {
7
7
  @Column({ type: 'varchar', length: 64, nullable: false })
8
8
  department_name: string;
9
9
 
10
+ @Column({ type: 'varchar', length: 255, nullable: true })
11
+ department_arabic_name: string | null;
12
+
10
13
  @Column({ type: 'varchar', length: 64, nullable: false})
11
14
  department_code: string;
12
15
 
@@ -11,6 +11,9 @@ export class DiplomaticTitlesMaster extends BaseModel {
11
11
  @Column({ type: 'varchar', length: 255, nullable: false })
12
12
  title: string; // Diplomatic title name
13
13
 
14
+ @Column({ type: 'varchar', length: 255, nullable: true })
15
+ diplomatic_title_arabic_name: string | null;
16
+
14
17
  @Column({ type: 'enum', enum: TitleCategory, nullable: false,default: TitleCategory.EMPLOYEE})
15
18
  category: TitleCategory; // Category: Employee or Non Employee
16
19
 
@@ -8,6 +8,9 @@ export class GroupNames extends BaseModel {
8
8
  @Column({ nullable: false })
9
9
  name: string;
10
10
 
11
+ @Column({ type: 'varchar', length: 255, nullable: true })
12
+ group_arabic_name: string | null;
13
+
11
14
  @Column({ nullable: true })
12
15
  description: string;
13
16
 
@@ -14,6 +14,9 @@ export class Location {
14
14
  @Column({ type: 'varchar', length: 255, nullable: false })
15
15
  name: string;
16
16
 
17
+ @Column({ type: 'varchar', length: 255, nullable: true })
18
+ location_arabic_name: string | null;
19
+
17
20
  @Column({ type: 'text', nullable: true })
18
21
  description: string;
19
22
 
@@ -1,36 +1,39 @@
1
- import { Column, Entity } from "typeorm";
2
- import { BaseModel } from './BaseModel';
3
-
4
- @Entity({ name: 'sections' })
5
- export class Sections extends BaseModel {
6
-
7
- @Column({ type: 'varchar', length: 64, nullable: false })
8
- section_name: string;
9
-
10
- @Column({ type: 'varchar', length: 64, nullable: false })
11
- section_code: string;
12
-
13
- @Column({ nullable: false })
14
- section_description: string;
15
-
16
- @Column({ type: 'bigint', nullable: true })
17
- department_id: number;
18
-
19
- @Column({ nullable: true , default: false})
20
- is_followup_sec?: boolean;
21
-
22
- constructor(
23
- section_name: string,
24
- section_code: string,
25
- section_description: string,
26
- department_id: number,
27
- is_followup_sec: boolean
28
- ) {
29
- super();
30
- this.section_name = section_name
31
- this.section_code = section_code
32
- this.section_description = section_description
33
- this.department_id = department_id
34
- this.is_followup_sec = is_followup_sec
35
- }
1
+ import { Column, Entity } from "typeorm";
2
+ import { BaseModel } from './BaseModel';
3
+
4
+ @Entity({ name: 'sections' })
5
+ export class Sections extends BaseModel {
6
+
7
+ @Column({ type: 'varchar', length: 64, nullable: false })
8
+ section_name: string;
9
+
10
+ @Column({ type: 'varchar', length: 255, nullable: true })
11
+ section_arabic_name: string | null;
12
+
13
+ @Column({ type: 'varchar', length: 64, nullable: false })
14
+ section_code: string;
15
+
16
+ @Column({ nullable: false })
17
+ section_description: string;
18
+
19
+ @Column({ type: 'bigint', nullable: true })
20
+ department_id: number;
21
+
22
+ @Column({ nullable: true , default: false})
23
+ is_followup_sec?: boolean;
24
+
25
+ constructor(
26
+ section_name: string,
27
+ section_code: string,
28
+ section_description: string,
29
+ department_id: number,
30
+ is_followup_sec: boolean
31
+ ) {
32
+ super();
33
+ this.section_name = section_name
34
+ this.section_code = section_code
35
+ this.section_description = section_description
36
+ this.department_id = department_id
37
+ this.is_followup_sec = is_followup_sec
38
+ }
36
39
  }
@@ -1,55 +1,57 @@
1
- import { Column, Entity, Index } from "typeorm";
2
- import { BaseModel } from "./BaseModel";
3
-
4
- export enum SlaRequestStatus {
5
- PENDING = "Pending",
6
- IN_PROGRESS = "In Progress",
7
- APPROVED = "Approved",
8
- REJECTED = "Rejected"
9
- }
10
-
11
- @Entity({ name: "sla_requests" })
12
- // @Index("uq_sla_requests_request_id", ["request_id"])
13
- @Index("idx_sla_requests_user_id", ["user_id"])
14
- @Index("idx_sla_requests_service_subservice", ["service_id", "sub_service_id"])
15
- @Index("idx_sla_requests_workflow_execution_id", ["workflow_execution_id"])
16
- @Index("idx_sla_requests_status", ["status"])
17
- export class SlaRequest extends BaseModel {
18
- @Column({ type: "int", nullable: true })
19
- req_user_department_id: number | null;
20
-
21
- @Column({ type: "int", nullable: true })
22
- req_user_section_id: number | null;
23
-
24
- @Column({ type: "int", nullable: true })
25
- service_id: number | null;
26
-
27
- @Column({ type: "int", nullable: true })
28
- sub_service_id: number | null;
29
-
30
- @Column({ type: "int", nullable: false })
31
- user_id: number;
32
-
33
- @Column({
34
- type: "enum",
35
- enum: SlaRequestStatus,
36
- default: SlaRequestStatus.PENDING,
37
- nullable: false
38
- })
39
- status: SlaRequestStatus;
40
-
41
- @Column({ type: "varchar", length: 255, nullable: true })
42
- workflow_execution_id: string | null;
43
-
44
- @Column({ type: "int", nullable: false })
45
- request_id: number;
46
-
47
- @Column({ type: "jsonb", nullable: false, default: () => "'{}'::jsonb" })
48
- request_obj: Record<string, unknown>;
49
-
50
- constructor() {
51
- super();
52
- this.request_id = 0;
53
- this.request_obj = {};
54
- }
55
- }
1
+ import { Column, Entity, Index } from "typeorm";
2
+ import { BaseModel } from "./BaseModel";
3
+
4
+ export enum SlaRequestStatus {
5
+ PENDING = "Pending",
6
+ IN_PROGRESS = "In Progress",
7
+ APPROVED = "Approved",
8
+ REJECTED = "Rejected",
9
+ ASSIGNED = "Assigned",
10
+ COMPLETED = "Completed"
11
+ }
12
+
13
+ @Entity({ name: "sla_requests" })
14
+ // @Index("uq_sla_requests_request_id", ["request_id"])
15
+ @Index("idx_sla_requests_user_id", ["user_id"])
16
+ @Index("idx_sla_requests_service_subservice", ["service_id", "sub_service_id"])
17
+ @Index("idx_sla_requests_workflow_execution_id", ["workflow_execution_id"])
18
+ @Index("idx_sla_requests_status", ["status"])
19
+ export class SlaRequest extends BaseModel {
20
+ @Column({ type: "int", nullable: true })
21
+ req_user_department_id: number | null;
22
+
23
+ @Column({ type: "int", nullable: true })
24
+ req_user_section_id: number | null;
25
+
26
+ @Column({ type: "int", nullable: true })
27
+ service_id: number | null;
28
+
29
+ @Column({ type: "int", nullable: true })
30
+ sub_service_id: number | null;
31
+
32
+ @Column({ type: "int", nullable: false })
33
+ user_id: number;
34
+
35
+ @Column({
36
+ type: "varchar",
37
+ length: 64,
38
+ default: SlaRequestStatus.PENDING,
39
+ nullable: false
40
+ })
41
+ status: string;
42
+
43
+ @Column({ type: "varchar", length: 255, nullable: true })
44
+ workflow_execution_id: string | null;
45
+
46
+ @Column({ type: "int", nullable: false })
47
+ request_id: number;
48
+
49
+ @Column({ type: "jsonb", nullable: false, default: () => "'{}'::jsonb" })
50
+ request_obj: Record<string, unknown>;
51
+
52
+ constructor() {
53
+ super();
54
+ this.request_id = 0;
55
+ this.request_obj = {};
56
+ }
57
+ }
@@ -18,13 +18,17 @@ export class Role extends BaseModel {
18
18
  @Column({ nullable: true })
19
19
  name: string;
20
20
 
21
+ @Column({ type: 'varchar', length: 255, nullable: true })
22
+ arabic_name: string | null;
23
+
21
24
  @Column({ nullable: true })
22
25
  is_deleted?: boolean;
23
26
 
24
27
 
25
- constructor(name: string, is_deleted:boolean) {
28
+ constructor(name: string, is_deleted: boolean, arabic_name: string | null = null) {
26
29
  super();
27
- this.name = name
28
- this.is_deleted = is_deleted
30
+ this.name = name;
31
+ this.is_deleted = is_deleted;
32
+ this.arabic_name = arabic_name;
29
33
  }
30
34
  }