Skip to content

Commit f75a0ab

Browse files
Copied schemas from nhd-notify-supplier-config - DO NOT MERGE THIS PR
1 parent fa5d2e1 commit f75a0ab

17 files changed

Lines changed: 702 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { z } from "zod";
2+
3+
export const $ChannelType = z.enum(["NHSAPP", "SMS", "EMAIL", "LETTER"]);
4+
5+
export type ChannelType = z.infer<typeof $ChannelType>;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { z } from "zod";
2+
3+
// eslint-disable-next-line import-x/prefer-default-export
4+
export const $EnvironmentStatus = z
5+
.enum(["DRAFT", "INT", "PROD", "DISABLED"])
6+
.meta({
7+
title: "EnvironmentStatus",
8+
description:
9+
"Indicates whether the configuration is in draft, or enabled in the integration or production environment. " +
10+
"`PROD` implies that the configuration is also enabled in the integration environment.",
11+
});
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { z } from "zod";
2+
3+
export const $Constraint = z
4+
.object({
5+
value: z.number(),
6+
operator: z
7+
.enum(["EQUALS", "NOT_EQUALS", "GREATER_THAN", "LESS_THAN"])
8+
.default("LESS_THAN"),
9+
})
10+
.meta({
11+
title: "Constraint",
12+
});
13+
export type Constraint = z.infer<typeof $Constraint>;
14+
15+
export const $Constraints = z.object({
16+
deliveryDays: $Constraint.optional().meta({
17+
title: "Delivery Days",
18+
description:
19+
"The expected number of days for delivery under this configuration.",
20+
}),
21+
sheets: $Constraint.optional().meta({
22+
title: "Sheets of paper",
23+
description:
24+
"The number of sheets that can be accommodated with this configuration.",
25+
}),
26+
sides: $Constraint.optional().meta({
27+
title: "Sides",
28+
description:
29+
"The number of sides to be printed for this letter. Dependent on duplex printing options.",
30+
}),
31+
blackCoveragePercentage: $Constraint.optional().meta({
32+
title: "Black Coverage Percentage",
33+
description:
34+
"The percentage of black coverage allowed on the paper under this configuration.",
35+
}),
36+
colourCoveragePercentage: $Constraint.optional().meta({
37+
title: "Colour Coverage Percentage",
38+
description:
39+
"The percentage of colour coverage allowed on the paper under this configuration.",
40+
}),
41+
});
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { z } from "zod";
2+
3+
export const $EnvelopeFeature = z.enum([
4+
"WHITEMAIL",
5+
"NHS_BRANDING",
6+
"NHS_BARCODE",
7+
]);
8+
9+
export const $Envelope = z
10+
.object({
11+
id: z.string(),
12+
name: z.string(),
13+
size: z.enum(["C5", "C4", "DL"]),
14+
features: z.array($EnvelopeFeature).optional(),
15+
artwork: z.url().optional().meta({
16+
title: "Artwork URL",
17+
description:
18+
"An S3 URL pointing to the artwork for this envelope, if applicable.",
19+
}),
20+
maxThicknessMm: z
21+
.number()
22+
.optional()
23+
.meta({
24+
title: "Max Thickness (mm)",
25+
description:
26+
"The maximum thickness in millimetres for this envelope. " +
27+
"Used to validate that the assembled pack will fit within the envelope.",
28+
}),
29+
maxSheets: z
30+
.number()
31+
.optional()
32+
.meta({
33+
title: "Max Sheets",
34+
description:
35+
"The maximum number of sheets that can be accommodated within this envelope. " +
36+
"Used to validate that the assembled pack will fit within the envelope.",
37+
}),
38+
})
39+
.describe("Envelope");
40+
export type Envelope = z.infer<typeof $Envelope>;
Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
# Event domain ERD
2+
3+
This document contains the mermaid diagrams for the event domain model.
4+
5+
The schemas are generated from Zod definitions and provide a visual representation of the data structure.
6+
7+
## AllSchemas schema
8+
9+
A Letter Variant describes a letter that can be produced with particular characteristics, and may be scoped to a single clientId and campaignId.
10+
11+
```mermaid
12+
erDiagram
13+
LetterVariant {
14+
string id
15+
string name
16+
string description
17+
string type "enum: STANDARD, BRAILLE, AUDIO"
18+
string status "enum: DRAFT, INT, PROD, DISABLED"
19+
string volumeGroupId "ref: VolumeGroup"
20+
string clientId
21+
string[] campaignIds
22+
string supplierId "ref: Supplier"
23+
string[] packSpecificationIds "ref: PackSpecification"
24+
Record constraints "&lt;string, Constraints&gt;"
25+
}
26+
PackSpecification {
27+
string id
28+
string name
29+
string description
30+
string status "enum: DRAFT, INT, PROD, DISABLED"
31+
string createdAt
32+
string updatedAt
33+
number version "min: -9007199254740991, max: 9007199254740991"
34+
string billingId
35+
Record constraints "&lt;string, Constraints&gt;"
36+
Postage postage
37+
Assembly assembly
38+
}
39+
Postage {
40+
string id
41+
string size "enum: STANDARD, LARGE, PARCEL"
42+
number deliveryDays
43+
number maxWeightGrams
44+
number maxThicknessMm
45+
}
46+
Assembly {
47+
string envelopeId "ref: Envelope"
48+
string printColour "enum: BLACK, COLOUR"
49+
number blackCoveragePercentage
50+
number colourCoveragePercentage
51+
boolean duplex
52+
Paper paper
53+
string[] insertIds "ref: Insert"
54+
string[] features "enum: BRAILLE, AUDIO, ADMAIL, SAME_DAY"
55+
Record additional "&lt;string, string&gt;"
56+
}
57+
Paper {
58+
string id
59+
string name
60+
number weightGSM
61+
string size "enum: A5, A4, A3"
62+
string colour "enum: WHITE"
63+
string finish "enum: MATT, GLOSSY, SILK"
64+
boolean recycled
65+
}
66+
VolumeGroup {
67+
string id
68+
string name
69+
string description
70+
string status "enum: DRAFT, INT, PROD, DISABLED"
71+
string startDate
72+
string endDate
73+
}
74+
Supplier {
75+
string id
76+
string name
77+
string channelType "enum: NHSAPP, SMS, EMAIL, LETTER"
78+
number dailyCapacity "min: -9007199254740991, max: 9007199254740991"
79+
string status "enum: DRAFT, INT, PROD, DISABLED"
80+
}
81+
SupplierAllocation {
82+
string id
83+
string volumeGroup "ref: VolumeGroup"
84+
string supplier "ref: Supplier"
85+
number allocationPercentage "positive, max: 100"
86+
string status "enum: DRAFT, INT, PROD, DISABLED"
87+
}
88+
SupplierPack {
89+
string id
90+
string packSpecificationId "ref: PackSpecification"
91+
string supplierId "ref: Supplier"
92+
string approval "enum: DRAFT, SUBMITTED, PROOF_RECEIVED, APPROVED, REJECTED, DISABLED"
93+
string status "enum: DRAFT, INT, PROD, DISABLED"
94+
}
95+
Envelope {
96+
string id
97+
string name
98+
string size "enum: C5, C4, DL"
99+
string[] features "enum: WHITEMAIL, NHS_BRANDING, NHS_BARCODE"
100+
string artwork "url"
101+
number maxThicknessMm
102+
number maxSheets
103+
}
104+
LetterVariant }o--|| VolumeGroup : "volumeGroupId"
105+
LetterVariant }o--o{ Supplier : "supplierId"
106+
LetterVariant }o--o{ PackSpecification : "packSpecificationIds"
107+
PackSpecification ||--|| Postage : "postage"
108+
PackSpecification ||--o{ Assembly : "assembly"
109+
Assembly }o--o{ Envelope : "envelopeId"
110+
Assembly ||--o{ Paper : "paper"
111+
SupplierAllocation }o--|| VolumeGroup : "volumeGroup"
112+
SupplierAllocation }o--|| Supplier : "supplier"
113+
SupplierPack }o--|| PackSpecification : "packSpecificationId"
114+
SupplierPack }o--|| Supplier : "supplierId"
115+
```
116+
117+
## LetterVariant schema
118+
119+
A Letter Variant describes a letter that can be produced with particular characteristics, and may be scoped to a single clientId and campaignId.
120+
121+
```mermaid
122+
erDiagram
123+
LetterVariant {
124+
string id
125+
string name
126+
string description
127+
string type "enum: STANDARD, BRAILLE, AUDIO"
128+
string status "enum: DRAFT, INT, PROD, DISABLED"
129+
string volumeGroupId "ref: VolumeGroup"
130+
string clientId
131+
string[] campaignIds
132+
string supplierId "ref: Supplier"
133+
string[] packSpecificationIds "ref: PackSpecification"
134+
Record constraints "&lt;string, Constraints&gt;"
135+
}
136+
LetterVariant }o--|| VolumeGroup : "volumeGroupId"
137+
LetterVariant }o--o{ Supplier : "supplierId"
138+
LetterVariant }o--o{ PackSpecification : "packSpecificationIds"
139+
```
140+
141+
## PackSpecification schema
142+
143+
A PackSpecification defines the composition, postage and assembly attributes for producing a pack.
144+
145+
```mermaid
146+
erDiagram
147+
PackSpecification {
148+
string id
149+
string name
150+
string description
151+
string status "enum: DRAFT, INT, PROD, DISABLED"
152+
string createdAt
153+
string updatedAt
154+
number version "min: -9007199254740991, max: 9007199254740991"
155+
string billingId
156+
Record constraints "&lt;string, Constraints&gt;"
157+
Postage postage
158+
Assembly assembly
159+
}
160+
Postage {
161+
string id
162+
string size "enum: STANDARD, LARGE, PARCEL"
163+
number deliveryDays
164+
number maxWeightGrams
165+
number maxThicknessMm
166+
}
167+
Assembly {
168+
string envelopeId "ref: Envelope"
169+
string printColour "enum: BLACK, COLOUR"
170+
number blackCoveragePercentage
171+
number colourCoveragePercentage
172+
boolean duplex
173+
Paper paper
174+
string[] insertIds "ref: Insert"
175+
string[] features "enum: BRAILLE, AUDIO, ADMAIL, SAME_DAY"
176+
Record additional "&lt;string, string&gt;"
177+
}
178+
Paper {
179+
string id
180+
string name
181+
number weightGSM
182+
string size "enum: A5, A4, A3"
183+
string colour "enum: WHITE"
184+
string finish "enum: MATT, GLOSSY, SILK"
185+
boolean recycled
186+
}
187+
Envelope {
188+
string id
189+
string name
190+
string size "enum: C5, C4, DL"
191+
string[] features "enum: WHITEMAIL, NHS_BRANDING, NHS_BARCODE"
192+
string artwork "url"
193+
number maxThicknessMm
194+
number maxSheets
195+
}
196+
PackSpecification ||--|| Postage : "postage"
197+
PackSpecification ||--o{ Assembly : "assembly"
198+
Assembly }o--o{ Envelope : "envelopeId"
199+
Assembly ||--o{ Paper : "paper"
200+
```
201+
202+
## SupplierAllocation schema
203+
204+
A volume group representing several lots within a competition framework under which suppliers will be allocated capacity.
205+
206+
```mermaid
207+
erDiagram
208+
VolumeGroup {
209+
string id
210+
string name
211+
string description
212+
string status "enum: DRAFT, INT, PROD, DISABLED"
213+
string startDate
214+
string endDate
215+
}
216+
Supplier {
217+
string id
218+
string name
219+
string channelType "enum: NHSAPP, SMS, EMAIL, LETTER"
220+
number dailyCapacity "min: -9007199254740991, max: 9007199254740991"
221+
string status "enum: DRAFT, INT, PROD, DISABLED"
222+
}
223+
SupplierAllocation {
224+
string id
225+
string volumeGroup "ref: VolumeGroup"
226+
string supplier "ref: Supplier"
227+
number allocationPercentage "positive, max: 100"
228+
string status "enum: DRAFT, INT, PROD, DISABLED"
229+
}
230+
SupplierAllocation }o--|| VolumeGroup : "volumeGroup"
231+
SupplierAllocation }o--|| Supplier : "supplier"
232+
```
233+
234+
## SupplierPack schema
235+
236+
Indicates that a supplier is capable of producing a specific pack specification.
237+
238+
```mermaid
239+
erDiagram
240+
SupplierPack {
241+
string id
242+
string packSpecificationId "ref: PackSpecification"
243+
string supplierId "ref: Supplier"
244+
string approval "enum: DRAFT, SUBMITTED, PROOF_RECEIVED, APPROVED, REJECTED, DISABLED"
245+
string status "enum: DRAFT, INT, PROD, DISABLED"
246+
}
247+
SupplierPack }o--|| PackSpecification : "packSpecificationId"
248+
SupplierPack }o--|| Supplier : "supplierId"
249+
```

0 commit comments

Comments
 (0)