@bslau/hmm_prisma_schema 1.21.2 → 1.22.0

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.
package/.prettierrc CHANGED
@@ -1,3 +1,5 @@
1
1
  {
2
- "plugins": ["prettier-plugin-prisma"]
3
- }
2
+ "plugins": [
3
+ "prettier-plugin-prisma"
4
+ ]
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bslau/hmm_prisma_schema",
3
- "version": "1.21.2",
3
+ "version": "1.22.0",
4
4
  "main": "index.js",
5
5
  "author": "CIPA Development Team",
6
6
  "license": "ISC",
@@ -0,0 +1,37 @@
1
+ BEGIN TRY
2
+
3
+ BEGIN TRAN;
4
+
5
+ -- CreateTable
6
+ CREATE TABLE [dbo].[MessageFailedToProcess] (
7
+ [id] INT NOT NULL IDENTITY(1,1),
8
+ [message] NVARCHAR(max) NOT NULL,
9
+ [messageTypeId] INT NOT NULL,
10
+ [reason] NVARCHAR(max) NOT NULL,
11
+ [isProcessed] BIT NOT NULL CONSTRAINT [MessageFailedToProcess_isProcessed_df] DEFAULT 0,
12
+ CONSTRAINT [MessageFailedToProcess_pkey] PRIMARY KEY CLUSTERED ([id])
13
+ );
14
+
15
+ -- CreateTable
16
+ CREATE TABLE [dbo].[MessageType] (
17
+ [id] INT NOT NULL IDENTITY(1,1),
18
+ [name] NVARCHAR(1000) NOT NULL,
19
+ [label] NVARCHAR(1000) NOT NULL,
20
+ CONSTRAINT [MessageType_pkey] PRIMARY KEY CLUSTERED ([id])
21
+ );
22
+
23
+ -- AddForeignKey
24
+ ALTER TABLE [dbo].[MessageFailedToProcess] ADD CONSTRAINT [MessageFailedToProcess_messageTypeId_fkey] FOREIGN KEY ([messageTypeId]) REFERENCES [dbo].[MessageType]([id]) ON DELETE NO ACTION ON UPDATE CASCADE;
25
+
26
+ COMMIT TRAN;
27
+
28
+ END TRY
29
+ BEGIN CATCH
30
+
31
+ IF @@TRANCOUNT > 0
32
+ BEGIN
33
+ ROLLBACK TRAN;
34
+ END;
35
+ THROW
36
+
37
+ END CATCH
@@ -683,3 +683,19 @@ model NotificationSource {
683
683
  label String
684
684
  notifications Notification[]
685
685
  }
686
+
687
+ model MessageFailedToProcess {
688
+ id Int @id @default(autoincrement())
689
+ message String @db.NVarChar(MAX)
690
+ messageTypeId Int
691
+ messageType MessageType @relation(fields: [messageTypeId], references: [id], onDelete: NoAction, onUpdate: Cascade)
692
+ reason String @db.NVarChar(MAX)
693
+ isProcessed Boolean @default(false)
694
+ }
695
+
696
+ model MessageType {
697
+ id Int @id @default(autoincrement())
698
+ name String
699
+ label String
700
+ messagesFailedToProcess MessageFailedToProcess[]
701
+ }
package/prisma/seed.ts CHANGED
@@ -530,6 +530,11 @@ async function main() {
530
530
  label: "Popup Torpedo Reject",
531
531
  description: "Appears as modal dialog, requires user acknowledgement.",
532
532
  },
533
+ {
534
+ name: "POPUP_TIMER_SWAP",
535
+ label: "Popup 6-Pit Swap Timer",
536
+ description: "Appears as modal dialog, permits user to extend Timer duration.",
537
+ },
533
538
  ],
534
539
  });
535
540
 
@@ -614,6 +619,37 @@ async function main() {
614
619
  console.log({createTorpedoTimeTypes})
615
620
  }
616
621
 
622
+ if (await prisma.messageType.count()>0) {
623
+ console.log("SEED: MessageType - skipped.");
624
+ }else {
625
+ console.log("SEED: MessageType - generating...");
626
+
627
+ const messageTypes = await prisma.messageType.createMany({
628
+ data: [
629
+ {
630
+ label: "CAST",
631
+ name: "Cast"
632
+ },
633
+ {
634
+ label: "TORPEDO_FILLING",
635
+ name: "Torpedo Filling"
636
+ },
637
+ {
638
+ label: "LIMS",
639
+ name: "Hot Metal Lab Result"
640
+ },
641
+ {
642
+ label: "WEIGHBRIDGE",
643
+ name: "BOS Weighbridge"
644
+ },
645
+ {
646
+ label: "POT_CONSUMED",
647
+ name: "Pot Consumed"
648
+ }
649
+ ]
650
+ })
651
+ console.log(messageTypes)
652
+ }
617
653
  }
618
654
 
619
655
  main()
package/tsconfig.json CHANGED
@@ -2,13 +2,20 @@
2
2
  "compilerOptions": {
3
3
  "target": "ES2022",
4
4
  "module": "CommonJS",
5
- "lib": ["ES2022"],
5
+ "lib": [
6
+ "ES2022"
7
+ ],
6
8
  "allowJs": true,
7
9
  "outDir": "build",
10
+ "types": [
11
+ "node"
12
+ ],
8
13
  "strict": true,
9
14
  "noImplicitAny": true,
10
15
  "esModuleInterop": true,
11
16
  "resolveJsonModule": true
12
17
  },
13
- "exclude": ["build"]
14
- }
18
+ "exclude": [
19
+ "build"
20
+ ]
21
+ }