docs
This commit is contained in:
39
docs/architecture/website/WEBSITE_PAGE_QUERIES.md
Normal file
39
docs/architecture/website/WEBSITE_PAGE_QUERIES.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# Website Page Queries (Server)
|
||||
|
||||
This document defines the only allowed server-side data fetching shape for `apps/website` routes.
|
||||
|
||||
## 1) Purpose
|
||||
|
||||
Page Queries are server-side composition classes that:
|
||||
|
||||
- call services that call `apps/api`
|
||||
- assemble a Page DTO
|
||||
- return an explicit result describing route outcome
|
||||
|
||||
They do not implement business rules.
|
||||
|
||||
## 2) Result type (no null)
|
||||
|
||||
Page Queries MUST return a discriminated union (`PageQueryResult`):
|
||||
|
||||
- `ok` with `{ dto }`
|
||||
- `notFound`
|
||||
- `redirect` with `{ to }`
|
||||
- `error` with `{ errorId }`
|
||||
|
||||
Pages MUST switch on this result and call:
|
||||
|
||||
- `notFound()` for `notFound`
|
||||
- `redirect()` for `redirect`
|
||||
|
||||
## 3) Forbidden responsibilities
|
||||
|
||||
Page Queries MUST NOT:
|
||||
|
||||
- format values for display
|
||||
- sort/filter (canonical or view-only)
|
||||
- instantiate ViewModels
|
||||
- instantiate Display Objects
|
||||
|
||||
If sorting/filtering is needed, it MUST be added to `apps/api`.
|
||||
|
||||
Reference in New Issue
Block a user