|
| 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 "<string, Constraints>" |
| 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 "<string, Constraints>" |
| 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 "<string, string>" |
| 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 "<string, Constraints>" |
| 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 "<string, Constraints>" |
| 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 "<string, string>" |
| 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