Description
Unable to display related data on Forest Admin Dashboard. Getting a message - There is no related data to explore. Kindly guide me on what am I missing and how to get my Dashboard display related data.
Feature(s) impacted
Explorer
I am trying to display related data for two tables Users and UserSubscriptions
Here is the code that I have added for creating relationships →
In /models/users.js
Users.hasOne(models.userSubscriptions, {
foreignKey: {
name: 'userIdKey',
field: 'userId',
},
sourceKey: 'userId',
as: 'userSubscription',
});
In models/user-subscriptions.js
UserSubscriptions.associate = (models) => {
UserSubscriptions.belongsTo(models.users, {
foreignKey: {
name: 'userIdKey',
field: 'userId',
},
targetKey: 'userId',
as: 'user',
});
};
One user can have only one subscription plan.
However, here is what I see in the explorer section for both the tables -
Also please note, I have not specified any keys on the actual table, is it required? Can we display related data without defining keys?
Observed behavior
Related data is not seen
Expected behavior
Related data should be seen.
Failure Logs
In this optional section, please:
- include any relevant log snippets if necessary,
- or remove this section if left empty.
Context
- Project name: …
- Team name: … Gerald
- Environment name: …Dev
- Agent type & version: …
- Recent changes made on your end if any: …