There is an undesirable pattern through all this code of having general logic inlined with route handlers. As the codebase grows, this gets unmanageable very quickly, and leads to duplication of logic and introduction of bugs. example, have a README util that gets called in the handler, rather than inlining the README processing logic: https://github.com/frictionlessdata/dpr-api/blob/master/app/site/controllers.py#L100
Acceptance criteria
[x] most inlined logic moved into function into utils
[x] functions are tested
Tasks
[x] Create logic folder and move site/logic.py up to there as /logic/__init__.py + move tests [no new test needed]
[x] Move package/controllers.py get package stuff into logic and refactor package/controllers.py to use [enhance existing logic test, no change to controller test]
[x] Marshmallow-ify logic.get_package(prep for all other work we are about to do) [new tests or addition to existing logic test]
[x] Refactor other code into logic from controllers
[x] move search "model" into logic (it really is logic ...)
There is an undesirable pattern through all this code of having general logic inlined with route handlers. As the codebase grows, this gets unmanageable very quickly, and leads to duplication of logic and introduction of bugs. example, have a README util that gets called in the handler, rather than inlining the README processing logic: https://github.com/frictionlessdata/dpr-api/blob/master/app/site/controllers.py#L100
Acceptance criteria
Tasks
logic
folder and move site/logic.py up to there as/logic/__init__.py
+ move tests [no new test needed]logic.get_package
(prep for all other work we are about to do) [new tests or addition to existing logic test]