uoregon-libraries / newspaper-curation-app

Suite of front- and back-end tools for the curation of digitized newspaper materials
Apache License 2.0
8 stars 1 forks source link

Separate data models from logic models #324

Open jechols opened 3 months ago

jechols commented 3 months ago

As part of an ongoing effort to make NCA easier to understand and maintain, we should separate everything that is strictly for database reading/writing from the rest of the app. The first step to doing this is making a data package under which our models live. Basic CRUD methods would live here, returning / modifying database-specific structs. Anything that transforms data from its raw DB presentation would be part of the app logic, and never live alongside the data package.

In addition, nothing outside of data would ever touch the database handler. The data package would have a method for connecting to the database and setting "debug" mode, but it would not expose the DB handler directly. All database operations would have to use some function within data.

Benefits: