@platform-modules/civil-aviation-authority 2.3.293 → 2.3.294

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,5 +1,4 @@
1
1
  import { BaseModel } from './BaseModel';
2
- import { FollowUpReportSubjectClassification } from './FollowUpReportRequestModel';
3
2
  export declare class FollowUpReportItem extends BaseModel {
4
3
  request_id: number;
5
4
  service_id: number | null;
@@ -7,7 +6,7 @@ export declare class FollowUpReportItem extends BaseModel {
7
6
  reference_type: string | null;
8
7
  letter_date: Date | null;
9
8
  subject: string | null;
10
- subject_classification: FollowUpReportSubjectClassification | null;
9
+ subject_classification: string | null;
11
10
  general_manager_comment: string | null;
12
11
  response_date_target: string | null;
13
12
  action_status: string | null;
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.FollowUpReportItem = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
14
  const BaseModel_1 = require("./BaseModel");
15
- const FollowUpReportRequestModel_1 = require("./FollowUpReportRequestModel");
16
15
  let FollowUpReportItem = class FollowUpReportItem extends BaseModel_1.BaseModel {
17
16
  };
18
17
  exports.FollowUpReportItem = FollowUpReportItem;
@@ -41,12 +40,7 @@ __decorate([
41
40
  __metadata("design:type", Object)
42
41
  ], FollowUpReportItem.prototype, "subject", void 0);
43
42
  __decorate([
44
- (0, typeorm_1.Column)({
45
- type: 'enum',
46
- enum: FollowUpReportRequestModel_1.FollowUpReportSubjectClassification,
47
- enumName: 'maintenance_subject_classification_en',
48
- nullable: true,
49
- }),
43
+ (0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
50
44
  __metadata("design:type", Object)
51
45
  ], FollowUpReportItem.prototype, "subject_classification", void 0);
52
46
  __decorate([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platform-modules/civil-aviation-authority",
3
- "version": "2.3.293",
3
+ "version": "2.3.294",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -37,6 +37,45 @@ ALTER TYPE maintenance_subject_classification_en ADD VALUE IF NOT EXISTS 'Highly
37
37
  ALTER TYPE maintenance_subject_classification_en ADD VALUE IF NOT EXISTS 'Restricted';
38
38
  ALTER TYPE maintenance_subject_classification_en ADD VALUE IF NOT EXISTS 'Limited';
39
39
 
40
+ -- 7b. Repair failed TypeORM enum swap (items column can remain on _old type)
41
+ DO $$
42
+ BEGIN
43
+ IF EXISTS (SELECT 1 FROM pg_type WHERE typname = 'maintenance_subject_classification_en_old') THEN
44
+ IF EXISTS (
45
+ SELECT 1
46
+ FROM information_schema.columns
47
+ WHERE table_schema = 'public'
48
+ AND table_name = 'followup_report_items'
49
+ AND column_name = 'subject_classification'
50
+ AND udt_name = 'maintenance_subject_classification_en_old'
51
+ ) THEN
52
+ ALTER TABLE followup_report_items
53
+ ALTER COLUMN subject_classification TYPE maintenance_subject_classification_en
54
+ USING subject_classification::text::maintenance_subject_classification_en;
55
+ END IF;
56
+
57
+ IF EXISTS (
58
+ SELECT 1
59
+ FROM information_schema.columns
60
+ WHERE table_schema = 'public'
61
+ AND table_name = 'followup_report_requests'
62
+ AND column_name = 'subject_classification'
63
+ AND udt_name = 'maintenance_subject_classification_en_old'
64
+ ) THEN
65
+ ALTER TABLE followup_report_requests
66
+ ALTER COLUMN subject_classification TYPE maintenance_subject_classification_en
67
+ USING subject_classification::text::maintenance_subject_classification_en;
68
+ END IF;
69
+
70
+ DROP TYPE maintenance_subject_classification_en_old;
71
+ END IF;
72
+ END $$;
73
+
74
+ -- 7c. Report items use varchar (nullable) so TypeORM sync does not fight shared PG enum on two tables
75
+ ALTER TABLE followup_report_items
76
+ ALTER COLUMN subject_classification TYPE VARCHAR(100)
77
+ USING subject_classification::text;
78
+
40
79
  -- 8. Contract service request: notes, company phone, contract documents table
41
80
  ALTER TABLE contract_service_requests
42
81
  ADD COLUMN IF NOT EXISTS notes TEXT,
@@ -0,0 +1,48 @@
1
+ -- Run this BEFORE shared_models synchronize if you see:
2
+ -- cannot drop type maintenance_subject_classification_en_old because other objects depend on it
3
+ --
4
+ -- Safe to re-run.
5
+
6
+ -- Add new enum values on the live type (no-op if already present)
7
+ ALTER TYPE maintenance_subject_classification_en ADD VALUE IF NOT EXISTS 'Important';
8
+ ALTER TYPE maintenance_subject_classification_en ADD VALUE IF NOT EXISTS 'Highly Confidential';
9
+ ALTER TYPE maintenance_subject_classification_en ADD VALUE IF NOT EXISTS 'Restricted';
10
+ ALTER TYPE maintenance_subject_classification_en ADD VALUE IF NOT EXISTS 'Limited';
11
+
12
+ DO $$
13
+ BEGIN
14
+ IF EXISTS (SELECT 1 FROM pg_type WHERE typname = 'maintenance_subject_classification_en_old') THEN
15
+ IF EXISTS (
16
+ SELECT 1
17
+ FROM information_schema.columns
18
+ WHERE table_schema = 'public'
19
+ AND table_name = 'followup_report_items'
20
+ AND column_name = 'subject_classification'
21
+ AND udt_name = 'maintenance_subject_classification_en_old'
22
+ ) THEN
23
+ ALTER TABLE followup_report_items
24
+ ALTER COLUMN subject_classification TYPE maintenance_subject_classification_en
25
+ USING subject_classification::text::maintenance_subject_classification_en;
26
+ END IF;
27
+
28
+ IF EXISTS (
29
+ SELECT 1
30
+ FROM information_schema.columns
31
+ WHERE table_schema = 'public'
32
+ AND table_name = 'followup_report_requests'
33
+ AND column_name = 'subject_classification'
34
+ AND udt_name = 'maintenance_subject_classification_en_old'
35
+ ) THEN
36
+ ALTER TABLE followup_report_requests
37
+ ALTER COLUMN subject_classification TYPE maintenance_subject_classification_en
38
+ USING subject_classification::text::maintenance_subject_classification_en;
39
+ END IF;
40
+
41
+ DROP TYPE maintenance_subject_classification_en_old;
42
+ END IF;
43
+ END $$;
44
+
45
+ -- Items column: varchar avoids TypeORM multi-table PG enum sync failures
46
+ ALTER TABLE followup_report_items
47
+ ALTER COLUMN subject_classification TYPE VARCHAR(100)
48
+ USING subject_classification::text;
@@ -1,6 +1,5 @@
1
1
  import { Column, Entity } from 'typeorm';
2
2
  import { BaseModel } from './BaseModel';
3
- import { FollowUpReportSubjectClassification } from './FollowUpReportRequestModel';
4
3
 
5
4
  @Entity({ name: 'followup_report_items' })
6
5
  export class FollowUpReportItem extends BaseModel {
@@ -22,13 +21,8 @@ export class FollowUpReportItem extends BaseModel {
22
21
  @Column({ type: 'varchar', length: 500, nullable: true })
23
22
  subject: string | null;
24
23
 
25
- @Column({
26
- type: 'enum',
27
- enum: FollowUpReportSubjectClassification,
28
- enumName: 'maintenance_subject_classification_en',
29
- nullable: true,
30
- })
31
- subject_classification: FollowUpReportSubjectClassification | null;
24
+ @Column({ type: 'varchar', length: 100, nullable: true })
25
+ subject_classification: string | null;
32
26
 
33
27
  @Column({ type: 'varchar', length: 500, nullable: true })
34
28
  general_manager_comment: string | null;