camicroscope / Caracal

Conslidated Backend, Auth, and Security Services for caMicroscope
GNU General Public License v3.0
15 stars 94 forks source link

Centralize Database operations #88

Closed YashKumarVerma closed 3 years ago

YashKumarVerma commented 3 years ago

Current design

all components of the application (handlers) interact with the database separately. The problems associated with this:

  1. Not reusing the connection.
  2. Frequent connect-disconnect cycles to the database.
  3. Redundant codebase and associated issues
    • all calls need to establish a connection.
    • repeated access to environment variables and need to assign default cases. Even Minor change requires edit in multiple files that essentially do the same thing.
    • set configurations ({useUnifiedTopology:true, ...}) in multiple places. Difficult to ship updates or fix bugs as all calls have separate behavior if configurations do not match.

Describe the solution you'd like

Describe alternatives you've considered

Additional context

birm commented 3 years ago

closed with #90