Repository navigation
Decide in the domain who may list all movements - #927
Merged
Merged
Conversation
The repository's resolveReader both loaded the reader's rights and decided with them (shared access, admin, allMovements), a business rule in the database adapter. Now the adapter only loads the facts (loadReaderFacts: the app user, its /admins and allMovements entries) and the pure domain function readAccess decides: whether the caller may list all and as which uid to read. listMovements wires the two; the repository builds the auth override from the caller it is given. checkAppRules keeps the airstat tables: they are the server's one port of the client tables (with client parity tests), and the airstat engine may only load files of its own folder. A comment says so. No change in behaviour; readAccess.spec covers the rule, the emulator read test the result against the built rules.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A follow-up to #926 that keeps the movement module hexagonal. In #926 the repository's
resolveReaderboth loaded thereader's rights and decided with them (shared access, admin, allMovements). That is a business rule inside the
database adapter. Behaviour does not change.
Changes
adapters/rtdbMovementRepository.js:loadReaderFacts(actor)only loads the facts:/adminsand/logins/<uid>/allMovementsentries.listMovementstakes the caller{uid, email}and builds the auth override itself.domain/readAccess.js(new, pure) decides whether the caller may list all movements and as which uid to read.application/listMovements.jswires the two.domain/checkAppRules.jskeeps usingreports/airstat/tables.jsand now says why in a comment. Those tables arethe server's one port of the client's flight type and category tables, with client parity tests. The airstat engine
may only load files of its own folder (
dependencyFree.spec.js), so they cannot move to a shared module.Test plan
readAccess.spec.js:trueentries count.rtdbMovementRepository.spec.js:listMovements.spec.jsandmovementRoutes.spec.jsadapted to the new port.npm test: 357 suites / 7906 testsnpm run typechecknpm run test:functions: 112 suites / 4672 testsnpm run test:rules(database emulator): parity 596/578/578/596, write assertions, and the list assertionsagainst the built lsze rules unchanged.
Generated by Claude Code