Serialization and deserialization of sqlalchemy objects for use in the API and UI are being done in our own bespoke (custom) manner. There are standard libraries that do this like marshmallow and we should use them.
Plan: Use marshmallow (and marshmallow-flask in logic / controller layer for serialization and deserialization. Replaces hand-rolled current work spread around controllers and in site.models.Packaged. Why? Standard, well-developed library for doing this.
Acceptance criteria
[x] We use marshmallow for communicating with models (where possible)
Tasks
[x] read docs and understand how marshmallow works [2]
[x] refactor Profile models [4]
[x] write tests for schemas
[x] prepare schemas for dumping (serialization)
[x] prepare schemas for loading (deserialization)
[x] refactor models models to use schemas
[x] move static methods using schemas in logic layer
[x] move tests from models
[x] refactor Package models [4]
[x] write tests for schemas
[x] prepare schemas for dumping (serialization)
[x] prepare schemas for loading (deserialization)
[x] refactor models models to use schemas
[x] move static methods using schemas in logic layer
Serialization and deserialization of sqlalchemy objects for use in the API and UI are being done in our own bespoke (custom) manner. There are standard libraries that do this like marshmallow and we should use them.
Plan: Use marshmallow (and marshmallow-flask in logic / controller layer for serialization and deserialization. Replaces hand-rolled current work spread around controllers and in site.models.Packaged. Why? Standard, well-developed library for doing this.
Acceptance criteria
Tasks
prepare schemas for loading (deserialization)[x] prepare schemas for loading (deserialization)