Biblio Backoffice uses a global Services struct which initializes all the objects when the program is executed. Via the Services() function, it's possible to request an initialized object. We've learned through OAI Service and Deliver that this extra level of abstraction is actually unnecessary. Moreover, it adds complexity making it harder to read / debug code.
This epic intends to remove the Services() code and bring the codebase more in line with how services are initialized in OAI Service and Deliver.
Success criteria
[ ] Refactor the constructor of the repository struct to match instantiation like in Deliver / OAI Service.
[ ] Refactor the constructor of the UGentLDAP repo to match instantiation like in Deliver / OAI Service.
[ ] Move repositoryrepository from Services() and initialize directly in the CLI commands.
[ ] Move UgentLDAP from Services() and initialize directly in the CLI commands.
Implementation suggestion
Before moving the repositories from Services(), the instantiation of both repository and UGentLDAP objects needs to be put in line with how this happens in OAI Service and Deliver. This requires refactoring their respective constructors first.
Automatic testing scenario
n/a
Additional information
A "repository" doesn't specifically mean "a database (PostgreSQL) repository". A repository is an abstraction layer that provides input / output capabilities for any kind of external resources e.g. LDAP, ElasticSearch, custom REST API's, file storage, object storage, etc.
A "repository", in our context, goes beyond CRUD interfacing with an external resource (PostgreSQL, LDAP, some API, etc.) It
might also contains functions / methods that implement business case specific logic as well.
Repositories should favor composability: the ability to compose behavior by leveraging multiple repository functions e.g. an iterator function in repository A could accept a callback function that calls a method in repository B (example).
Story
Biblio Backoffice uses a global
Services
struct which initializes all the objects when the program is executed. Via theServices()
function, it's possible to request an initialized object. We've learned through OAI Service and Deliver that this extra level of abstraction is actually unnecessary. Moreover, it adds complexity making it harder to read / debug code.This epic intends to remove the
Services()
code and bring the codebase more in line with how services are initialized in OAI Service and Deliver.Success criteria
repository
struct to match instantiation like in Deliver / OAI Service.UGentLDAP
repo to match instantiation like in Deliver / OAI Service.repository
repository from Services() and initialize directly in the CLI commands.UgentLDAP
from Services() and initialize directly in the CLI commands.Implementation suggestion
Before moving the repositories from
Services()
, the instantiation of bothrepository
andUGentLDAP
objects needs to be put in line with how this happens in OAI Service and Deliver. This requires refactoring their respective constructors first.Automatic testing scenario
n/a
Additional information