76 lines
3.8 KiB
Markdown
76 lines
3.8 KiB
Markdown
# Functional Design: domain entities (units H1 to H5)
|
|
|
|
Database: one new migration in the Hero module's own DbContext (MariaDB, hand-written like the Offerings migrations). Tables use the prefix `Hero`.
|
|
|
|
## Tables
|
|
|
|
### `Heroes`
|
|
|
|
| Column | Type | Notes |
|
|
|---|---|---|
|
|
| `Id` | `char(36)` | primary key |
|
|
| `Language` | `varchar(10)` | default `nl`, unique |
|
|
| `Title` | `varchar(1000)` | max 200 chars by validation; room for 5 lines |
|
|
| `Tagline` | `varchar(200)` | max 120 |
|
|
| `Lead` | `varchar(1000)` | max 600 |
|
|
| `Display` | `varchar(20)` | `single` or `slideshow` |
|
|
| `Button1Label`, `Button1Target`, `Button2Label`, `Button2Target` | `varchar(100)` / `varchar(500)` | nullable pairs |
|
|
| `StartsAt`, `EndsAt` | `datetime(6)` | nullable, UTC |
|
|
| `IsActive` | `bit` | default true |
|
|
| `UpdatedAt` | `datetime(6)` | UTC |
|
|
| `UpdatedBy` | `varchar(256)` | actor id or name |
|
|
|
|
### `HeroImages`
|
|
|
|
| Column | Type | Notes |
|
|
|---|---|---|
|
|
| `Id` | `char(36)` | primary key |
|
|
| `OriginalSha256` | `char(64)` | content hash of the stored original |
|
|
| `OriginalKey` | `varchar(200)` | `originals/<sha256>.<ext>` |
|
|
| `SourceFormat` | `varchar(10)` | `jpeg`, `png`, ... |
|
|
| `Width`, `Height` | `int` | original pixel size |
|
|
| `Bytes` | `bigint` | size of the stored original |
|
|
| `FocusX`, `FocusY`, `Zoom` | `double` | general setting; default 0.5, 0.5, 1 |
|
|
| `WideFocusX`, `WideFocusY`, `WideZoom` | `double?` | optional override |
|
|
| `TallFocusX`, `TallFocusY`, `TallZoom` | `double?` | optional override |
|
|
| `SetHash` | `char(16)` | current set |
|
|
| `VariantsJson` | `json`/`longtext` | list of `{ratio, width, height, type, key, bytes}` of the current set |
|
|
| `RetiredSetsJson` | `longtext` | previous sets with their retire time (for the 7-day clean-up) |
|
|
| `CreatedAt`, `CreatedBy` | `datetime(6)`, `varchar(256)` | |
|
|
|
|
### `HeroSlides`
|
|
|
|
| Column | Type | Notes |
|
|
|---|---|---|
|
|
| `Id` | `char(36)` | primary key, stable id used by the sites |
|
|
| `HeroId` | `char(36)` | foreign key, cascade delete |
|
|
| `ImageId` | `char(36)` | foreign key, restrict (deleting an image in use is refused) |
|
|
| `Alt` | `varchar(600)` | max 300 chars by validation |
|
|
| `Decorative` | `bit` | |
|
|
| `SortOrder` | `int` | unique per hero |
|
|
| `IsActive` | `bit` | |
|
|
|
|
Indexes: `Heroes(Language)` unique; `HeroSlides(HeroId, SortOrder)` unique; `HeroSlides(ImageId)`.
|
|
|
|
## Public DTOs (shape fixed in `component-methods.md`)
|
|
|
|
`PublicHeroDto { display, title, tagline, lead, buttons[], slides[] }`, `PublicSlideDto { id, alt, decorative, image }`, `PublicImageDto { width, height, focus{x,y,zoom}, focusByRatio?, src, srcset?, variants[] }`, `PublicVariantDto { ratio, width, height, type, url }`. `focusByRatio` is present only when an override exists. Fields that are null are written as JSON null (like the offerings data); the shapes match the ASF golden inputs (`web/contract/host-injection/hero/*.input.json`).
|
|
|
|
## Pure value types (H1, Core.Media)
|
|
|
|
`ImageFormat` (enum), `ImageInfo { Format, Width, Height, FrameCount }`, `Ratio`, `FocusSetting`, `CropRect { X, Y, Width, Height }`, `VariantSpec { Ratio, Width, Height, Format, Quality }`, `RenderedImage { Bytes, Width, Height, Format }`, `MediaAddress { Area, SetHash, Name }`.
|
|
|
|
## Configuration
|
|
|
|
| Key | Default | Meaning |
|
|
|---|---|---|
|
|
| `Media:Directory` | none (required for uploads) | the media directory outside the release |
|
|
| `Media:MaxUploadBytes` | 10 485 760 | upload limit |
|
|
| `Media:MaxPixels` | 64 000 000 | pixel ceiling |
|
|
| `Media:MaxParallelJobs` | 2 | processing slots |
|
|
| `Media:DecodeTimeoutSeconds` | 20 | per image |
|
|
| `Media:MaxTotalBytes` | 2 147 483 648 | safety limit of the directory |
|
|
| `Media:RetentionDays` | 7 | retired files |
|
|
| `Hero:MaxPublishedSlides` | 50 | technical ceiling on published slides |
|
|
| `RateLimiting:HeroPublic`, `MediaPublic`, `HeroUpload` | 120/60 s, 600/60 s, 20/hour per user | policies |
|