How data moves through a domain slice in packages/api, and where each piece of logic belongs.
ModelList.MapperFn functions, one instance per service.fetch* vs. get* / find*.REST service → response model → mapper → UI model → service / context service → consumers
toEnum, services/utils/enum-util.ts). Mapping back for a request goes
through a mapper too.…Response (AuthenticatedUserResponse), never …Dto.
It marks a field optional only when the backend actually omits it, and it has no index signature.isNew(), clearHoveredState()), not in a *-utils.ts.ModelList (models/common/model-list.ts). A method specific to one model goes in the
subclass, never in ModelList.find, filter or index into a model’s arrays. Add the method to the model or its ModelList
subclass, so the structure can change without touching callers.ModelList subclass), never to a plain [].window.Partial<Model> and assigns it 1:1. Don’t add a ModelInit interface that repeats
the model’s fields, and don’t transform data there; that is the mapper’s job.id extends IdModel.Mappers are MapperFn functions in the service’s mappers/ folder. Where a mapper is a class, the service keeps
one instance as a field instead of creating it per call.
A mapper doesn’t mutate its input. Derive values into locals and build the model from them.
fetch* is for methods that call the backend; local lookups are get* / find*.