GEWIS / sudosos-backend

SudoSOS is a Node.js-based Bar and POS system made for study association GEWIS.
https://sudosos.gewis.nl
GNU Affero General Public License v3.0
6 stars 3 forks source link

[Refactor] Make `Bindings` an abstract class and inject it in service / controller construction. #341

Open JustSamuel opened 1 month ago

JustSamuel commented 1 month ago

Currently we use the default class Bindings to modify global functions on the go. This is a cheap way to do dependency injection but has the following downsides:

I suggest we turn the Bindings class unto an abstract class and create a DefaultBindings and GewisBindings which implement this class. These define how the function show work in their own scope.

Once defined we can simply modify the constructor of the services / controllers to take a instance of the abstract Bindings class as parameter. This would also make testing both implementations easier.