prior-art-archive / priorartarchive.org

Prior Art Archive Site
https://priorartarchive.org
GNU General Public License v2.0
3 stars 1 forks source link

Refactor model code structure #21

Open slifty opened 5 years ago

slifty commented 5 years ago

We right now have a models.js which is fine as a starting point. It is good practice to have a models/ directory where each model has its own file. This is mostly intended to avoid the situation where we have a long monolithic file.

isTravis commented 5 years ago

Agreed. We've refactored our PubPub to be structured like this. If you'd like an example of how to deal with Sequelize and associations when split across files - feel free to take a look at the PubPub /models folder.

Also happy to submit a PR for this if it's not a rush.

slifty commented 5 years ago

@isTravis that would be awesome; I'll assign it to you (and if we get to it before you start then I'll coordinate)