do to formatters
This commit is contained in:
@@ -51,20 +51,7 @@ Canonical placement in this repo:
|
||||
|
||||
- `apps/website/lib/types/**` (transport DTOs consumed by services and page queries)
|
||||
|
||||
### 3.2 API Transport DTO
|
||||
|
||||
Definition: the shape returned by the backend API over HTTP.
|
||||
|
||||
Rules:
|
||||
|
||||
- API Transport DTOs MUST be contained inside infrastructure.
|
||||
- API Transport DTOs MUST NOT be imported by Templates.
|
||||
|
||||
Canonical placement in this repo:
|
||||
|
||||
- `apps/website/lib/types/**` (transport DTOs consumed by services and page queries)
|
||||
|
||||
### 3.3 ViewData
|
||||
### 3.2 ViewData
|
||||
|
||||
Definition: the only allowed input type for Templates.
|
||||
|
||||
@@ -73,6 +60,7 @@ Rules:
|
||||
- JSON-serializable only.
|
||||
- Contains only template-ready values (mostly strings/numbers/booleans).
|
||||
- MUST NOT contain class instances.
|
||||
- **Uncle Bob says**: "Data structures should not have behavior."
|
||||
|
||||
See [`VIEW_DATA.md`](docs/architecture/website/VIEW_DATA.md:1).
|
||||
|
||||
@@ -89,6 +77,7 @@ Rules:
|
||||
- Instantiated only in `'use client'` modules.
|
||||
- Never serialized.
|
||||
- Used for client components that need state management.
|
||||
- **Uncle Bob says**: "Objects expose behavior, not data."
|
||||
|
||||
See [`VIEW_MODELS.md`](docs/architecture/website/VIEW_MODELS.md:1).
|
||||
|
||||
@@ -112,6 +101,7 @@ Rules:
|
||||
- MUST NOT call the API.
|
||||
- Input: `Result<ApiDto, string>` or `ApiDto`
|
||||
- Output: ViewModel
|
||||
- MUST use `static build()` and `satisfies ViewModelBuilder`.
|
||||
|
||||
See [`BUILDERS.md`](docs/architecture/website/BUILDERS.md:1).
|
||||
|
||||
@@ -133,6 +123,7 @@ Rules:
|
||||
- MUST NOT call the API.
|
||||
- Input: `Result<ApiDto, string>` or `ApiDto`
|
||||
- Output: ViewData
|
||||
- MUST use `static build()` and `satisfies ViewDataBuilder`.
|
||||
|
||||
See [`BUILDERS.md`](docs/architecture/website/BUILDERS.md:1).
|
||||
|
||||
@@ -161,18 +152,18 @@ Canonical placement in this repo:
|
||||
|
||||
- `apps/website/lib/contracts/Result.ts`
|
||||
|
||||
### 4.3 Display Object
|
||||
### 4.4 Formatter & Display Object
|
||||
|
||||
Definition: deterministic, reusable, UI-only formatting/mapping logic.
|
||||
|
||||
Rules:
|
||||
|
||||
- Class-based, immutable, deterministic.
|
||||
- MUST NOT call `Intl.*`.
|
||||
- MUST NOT call any `toLocale*`.
|
||||
- **Formatters**: Stateless utilities for server-side primitive output.
|
||||
- **Display Objects**: Rich Value Objects for client-side interactive APIs.
|
||||
- MUST NOT call `Intl.*` or `toLocale*` (unless client-only).
|
||||
- MUST NOT implement business rules.
|
||||
|
||||
See [`DISPLAY_OBJECTS.md`](docs/architecture/website/DISPLAY_OBJECTS.md:1).
|
||||
See [`FORMATTERS.md`](docs/architecture/website/FORMATTERS.md:1).
|
||||
|
||||
Canonical placement in this repo:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user