Files
gridpilot.gg/docs/architecture/website/WEBSITE_PAGE_QUERIES.md
2026-01-11 13:04:33 +01:00

896 B

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.