@platform-modules/civil-aviation-authority 2.3.270 → 2.3.272

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,3 @@
1
- import { SlaRequestStatus } from "./SlaRequestModel";
2
1
  /** Top-level `request_obj` keys omitted from `request_fields` (see sql/vw_sla_my_requests.sql). */
3
2
  export declare const SLA_MY_REQUESTS_REQUEST_OBJ_EXCLUDED_KEYS: readonly ["id", "status", "role_id", "user_id", "createdBy", "created_at", "updated_by", "updated_at", "req_user_department_id", "workflow_execution_id", "department_id", "req_user_section_id", "service_type_id", "service_type", "created_by", "service_id", "sub_service_id", "attachments", "is_deleted", "sla_request", "sla_request_id"];
4
3
  /**
@@ -20,7 +19,7 @@ export declare class SlaMyRequestsView {
20
19
  req_user_section_id: string;
21
20
  service_name: string;
22
21
  sub_service_name: string;
23
- status: SlaRequestStatus | string;
22
+ status: string;
24
23
  request_id: number;
25
24
  /** Remaining `request_obj` keys after excluding workflow/common duplicates. */
26
25
  request_fields: Record<string, unknown>;
@@ -23,7 +23,7 @@ export declare class SlaRequest extends BaseModel {
23
23
  service_id: number | null;
24
24
  sub_service_id: number | null;
25
25
  user_id: number;
26
- status: SlaRequestStatus;
26
+ status: string;
27
27
  workflow_execution_id: string | null;
28
28
  /**
29
29
  * Native service request PK this SLA row tracks (non-unique index; scope with service_id/sub_service_id in queries).
@@ -61,8 +61,8 @@ __decorate([
61
61
  ], SlaRequest.prototype, "user_id", void 0);
62
62
  __decorate([
63
63
  (0, typeorm_1.Column)({
64
- type: "enum",
65
- enum: SlaRequestStatus,
64
+ type: "varchar",
65
+ length: 64,
66
66
  default: SlaRequestStatus.PENDING,
67
67
  nullable: false
68
68
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platform-modules/civil-aviation-authority",
3
- "version": "2.3.270",
3
+ "version": "2.3.272",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -0,0 +1,34 @@
1
+ -- Migrate sla_requests.status from PostgreSQL enum to varchar(64) in-place (preserves data).
2
+ -- Drops SLA views only when converting from enum (safe for sync:sla-sql manifest runs).
3
+ -- Idempotent when status is already varchar(64).
4
+
5
+ DO $$
6
+ DECLARE
7
+ status_udt text;
8
+ BEGIN
9
+ SELECT c.udt_name
10
+ INTO status_udt
11
+ FROM information_schema.columns c
12
+ WHERE c.table_schema = 'public'
13
+ AND c.table_name = 'sla_requests'
14
+ AND c.column_name = 'status';
15
+
16
+ IF status_udt = 'sla_requests_status_enum' THEN
17
+ DROP VIEW IF EXISTS vw_sla_approvals CASCADE;
18
+ DROP VIEW IF EXISTS vw_sla_my_requests CASCADE;
19
+
20
+ ALTER TABLE sla_requests
21
+ ALTER COLUMN status TYPE varchar(64) USING status::text;
22
+
23
+ DROP TYPE IF EXISTS sla_requests_status_enum;
24
+ ELSIF status_udt = 'varchar' THEN
25
+ ALTER TABLE sla_requests
26
+ ALTER COLUMN status TYPE varchar(64);
27
+ END IF;
28
+ END $$;
29
+
30
+ ALTER TABLE sla_requests
31
+ ALTER COLUMN status SET DEFAULT 'Pending';
32
+
33
+ ALTER TABLE sla_requests
34
+ ALTER COLUMN status SET NOT NULL;
@@ -1,4 +1,5 @@
1
1
  [
2
+ "alter_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",
@@ -1,5 +1,4 @@
1
1
  import { ViewColumn, ViewEntity } from "typeorm";
2
- import { SlaRequestStatus } from "./SlaRequestModel";
3
2
 
4
3
  /** Top-level `request_obj` keys omitted from `request_fields` (see sql/vw_sla_my_requests.sql). */
5
4
  export const SLA_MY_REQUESTS_REQUEST_OBJ_EXCLUDED_KEYS = [
@@ -122,7 +121,7 @@ export class SlaMyRequestsView {
122
121
  sub_service_name: string;
123
122
 
124
123
  @ViewColumn()
125
- status: SlaRequestStatus | string;
124
+ status: string;
126
125
 
127
126
  @ViewColumn()
128
127
  request_id: number;
@@ -44,12 +44,12 @@ export class SlaRequest extends BaseModel {
44
44
  user_id: number;
45
45
 
46
46
  @Column({
47
- type: "enum",
48
- enum: SlaRequestStatus,
47
+ type: "varchar",
48
+ length: 64,
49
49
  default: SlaRequestStatus.PENDING,
50
50
  nullable: false
51
51
  })
52
- status: SlaRequestStatus;
52
+ status: string;
53
53
 
54
54
  @Column({ type: "varchar", length: 255, nullable: true })
55
55
  workflow_execution_id: string | null;
package/src/scripts.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { AppDataSource } from './data-source';
2
-
3
- AppDataSource.initialize()
4
- .then(() => {
5
- console.log('✅ Database schema synchronized successfully.');
6
- })
7
- .catch((error: any) => {
8
- console.error('❌ Error during schema synchronization:', error);
9
- process.exit(1);
10
- });
1
+ import { AppDataSource } from './data-source';
2
+
3
+ AppDataSource.initialize()
4
+ .then(() => {
5
+ console.log('✅ Database schema synchronized successfully.');
6
+ })
7
+ .catch((error: any) => {
8
+ console.error('❌ Error during schema synchronization:', error);
9
+ process.exit(1);
10
+ });