After modifying my repositories to directly return the GQL resolvers, everything was going smoothly until I encountered a circular dependency issue. Now, I have two repositories that rely on each other, creating a dilemma that JavaScript cannot easily resolve. Is there a solution to this problem?
ARepository.getA = () => {
const a = getAFromDatabase();
return {
...a,
B: BRepository.getB()
}
Describing the first repository:
BRepository.getB = () => {
const b = getBFromDatabase();
return {
...b,
A: ARepository.getA()
}
Both repositories have interdependencies, making it impossible to define one without the other. This creates a deadlock situation where neither repository can be fully defined.