Skip to content

zettelkasten.dashboard.backend.routes

zettelkasten.dashboard.backend.routes

Assembly point for the Zettelkasten Dashboard API routes.

The former flat routes.py (~130 endpoints on one APIRouter) is now a per-domain package: shared state + helpers live in :mod:._common, and each domain module (:mod:.notes, :mod:.citations, ...) defines its own APIRouter. This package module is the assembly point — it builds the single top-level router by including each sub-router, and it re-exports every symbol the sub-modules define so that from ...routes import router / import ...routes as routes and every routes.<name> access (handlers, helpers, caches, request models, the organizations/remine/... modules) keep resolving exactly as before.

Legacy monkeypatch compatibility: the pre-split tests patch module globals on THIS package (e.g. monkeypatch.setattr(routes, "GRAPHS_DIR", tmp) or routes._get_graph). When everything lived in one module those patches were seen by every handler. Handlers now resolve those names in their own sub-module namespace, so this module object installs a __setattr__ that fans any post-import attribute assignment out to _common and every domain sub-module that already binds that name — reproducing the single-namespace patch semantics without changing any handler body.