@bslau/hmm_prisma_schema 1.21.3 → 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
package/package.json
CHANGED
package/prisma/migrations/20260408005312_create_table_to_store_unprocessed_messages/migration.sql
ADDED
|
@@ -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
|
package/prisma/schema.prisma
CHANGED
|
@@ -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
|
@@ -619,6 +619,37 @@ async function main() {
|
|
|
619
619
|
console.log({createTorpedoTimeTypes})
|
|
620
620
|
}
|
|
621
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
|
+
}
|
|
622
653
|
}
|
|
623
654
|
|
|
624
655
|
main()
|
package/tsconfig.json
CHANGED
|
@@ -2,13 +2,20 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"target": "ES2022",
|
|
4
4
|
"module": "CommonJS",
|
|
5
|
-
"lib": [
|
|
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": [
|
|
14
|
-
|
|
18
|
+
"exclude": [
|
|
19
|
+
"build"
|
|
20
|
+
]
|
|
21
|
+
}
|