Hello
I am on the same contexte as [Express] Smart Relationship do not display global smart action
I have a 3 entity: Annonce, Application, Beneficiary
With these relations :
- Annonce.hasMany(Application)
- Annonce.BelongsTo(Beneficiary)
I created a Smart-relationships between Beneficiary and Application but the belongsTo link are not display. But if i click on a application record dans I back to my related data the link are well displayed.
Related data - Smart relationship (before record clicked)
Related data - Smart relationship (after record clicked)
Network response from Smart relationship
Network response Native related-data announce → application
In the native response we have the “relationships”. Is it a way to force response with the relationships (because i’m sure the problem from that)
collections/beneficiary.js
{
field: 'Candidatures',
type: ['String'],
reference: 'application.id',
}
routes/beneficiary.js
router.get(
'/beneficiary/:recordId/relationships/Candidatures',
permissionMiddlewareCreator.details(),
async (request, response) => {
const limit = parseInt(request.query.page.size, 10) || 20;
const offset = (parseInt(request.query.page.number, 10) - 1) * limit;
const beneficiaryId = get(request, 'params.recordId');
const { id: announceId } = await models.announce.findOne({
where: { beneficiaryIdKey: beneficiaryId },
});
const { count, rows: applications } = await models.application.findAndCountAll({
where: {
announceIdKey: announceId,
},
offset,
limit,
order: [['createdAt', 'DESC']],
});
const serializer = new RecordSerializer(models.application);
const recordSerialized = await serializer.serialize(applications, { count });
return response.send(recordSerialized);
},
);