docs(backend): CS-13 — a new module needs its staff texts in modules.json
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -157,7 +157,7 @@ Automated tests cover the native-app/LAN work and licensing. See **[tests/e2e/RE
|
||||
New and touched endpoints raise `core.errors.XeniaError("<code>", **params)`; register the code with its status and English message in `CODES`. Responses look like `{"error": {code, params, message}, "detail"}`; plain `HTTPException`s are wrapped as `http.<status>` until converted. Text the backend renders itself (printed tickets and reports, later notifications) goes through `core.i18n.t(key, lang)` with keys in `core/i18n/en.json` + `el.json` (same keys, same placeholders; Greek print text without accents). Kitchen tickets print in the prep zone's language, everything else in `venue.language`.
|
||||
|
||||
**CS-13. Every router belongs to a module** (branch `platform-v2`, D-19, §4).
|
||||
Routers are mounted from the module manifests (`local_backend/modules/<key>/manifest.py` → `Mount(...)`), not from a list in `main.py`. A new router gets a `Mount` in its module's manifest (or a new module folder); a test fails if any router in `routers/` isn't mounted. New settings are declared as `SettingDef` in the owning manifest (the settings API reads them from there). Background loops that belong to a module are manifest `workers`, started and stopped by the supervisor, never started by hand in `main.py`.
|
||||
Routers are mounted from the module manifests (`local_backend/modules/<key>/manifest.py` → `Mount(...)`), not from a list in `main.py`. A new router gets a `Mount` in its module's manifest (or a new module folder); a test fails if any router in `routers/` isn't mounted. New settings are declared as `SettingDef` in the owning manifest (the settings API reads them from there). Background loops that belong to a module are manifest `workers`, started and stopped by the supervisor, never started by hand in `main.py`. A new module (or a new limit) also needs its staff-facing name, description and limit labels in `packages/i18n/locales/{en,el}/modules.json`; `tests/test_module_texts.py` fails until they exist.
|
||||
|
||||
**CS-14. Every route declares who may call it** (branch `platform-v2`, D-7, D-17).
|
||||
Use `core.access.deps.require("<module>.<area>.<action>")` (or `require_any`, `public()`, `require_device(app)`), or `Depends(get_current_user)` for "any signed-in user". The guard `tests/guards/test_route_access.py` fails a route with no marker or with an unknown key. New keys are declared as `Perm(...)` in the owning manifest, with their default roles. Inside code use `core.access.check.holds(user, key)` / `can(user, key)`, never role names or `perm_*` attributes (`tests/guards/test_no_perm_reads.py`). The v1 booleans exist only in `core/access/legacy.py` for the current frontends.
|
||||
|
||||
Reference in New Issue
Block a user