Module refactor

Branched from error-handling

Now objects are instantiated with a require statement, and dependencies are passed in to the module's constructor.

The repositories still have to pass the dbConfig into the common_repository quite a lot, so we could consider converting the common_repository into an object and inject the dbConfig into its constructor.