I am trying to access a target model and its related models in a hasManyThrough setup in Loopback 4. For example in the documentation:
https://loopback.io/doc/en/lb4/HasManyThrough-relation.html
how do I get all appointments of a specific doctor with the patient data included?
When I try to access /doctors (with exact same setup in the above article) with the following filter:
const filter = {
include: [
{ relation: 'patients' },
]};
I do get to see the list of patients.
However, I'd like access /doctors with the following filter:
const filter = {
include: [
{ relation: 'appointments',
scope: {
include: [{relation: 'patient'}],
},
},
]
};
Is there a way the hasManyThrough relationship supports this? Or do I need to connect my models differently through custom logic instead.