Hello @kll,
Thanks for reaching out!
If I understood well your use case, there is unfortunately no way to fix this in the UI.
However, it should be doable and not too complicated to do it in the code, overriding your GET route to band
and using the request.query.context
.
Something like this:
router.get('/bands', permissionMiddlewareCreator.list(), async (request, response, next) => {
if (request.query.context.record.type === 'bandMember') {
const bandMember = await bandMembers.findByPk(request.query.context.record.id, {
include: [ { model: concerts, attributes: ['id'] } ]
});
const bandMemberConcertIds = band.concerts.map(concert => concert.id);
const foundBands = await bands.findAll({
where: {
concertId: { [Op.in]: bandMemberConcertIds }
}
});
const serializer = new RecordSerializer(bands, request.user, request.query);
response.send(await serializer.serialize(foundBands));
} else {
next();
}
});
Let me know if this helps!
Thanks.