thecodegram / codegram

🚀 Codegram: A social hub for competitive coders & problem-solvers! Dive into challenges, collaborate on solutions, and expand your coding circle
https://codegram-client.onrender.com/
GNU Affero General Public License v3.0
6 stars 0 forks source link

Exporting repositories as singletons #7

Closed ShayGeko closed 1 year ago

ShayGeko commented 1 year ago

To allow for stubbing in unit tests, repositories and services are now imported/exported as a singleton object, rather than a class that is instantiated whenever it is used.

It was a choice between introducing Dependency Injection with Inversion of Control and this. Ultimately we should migrate to use DI with IOC, but for now this is good enough as our repositories and services are stateless.

closes #4