How to create relationship with 2 keys

I want to integrate the following Hasura Object relationships into the sequelize Forest Admin code.
user_case_junction_details
automatic_payment_details . ( case_id, user_id ) → user_case_junction . ( case_id, user_id )

Hello @Supportpay,

If you are using the agent forest-express-sequelize, you can refer to this documentation page about Smart Relationships. Which will allow you to create relationships between two data sets.

Best regards,

I’m not sure what you are expecting of me here. The linked documentation page contains enough information for you to be able to create your Smart Relationship.

If you were not able to make it work, I could help you out if you were to give me your implementation or a more detailed question about what your issue is.

Copy pasting the same message won’t allow us to dig this further, nor will I fill out your code snippets as I’m not an AI.

e_check_details
automatic_payment_details . user_id → epay_registration . user_id

AutomaticPaymentDetails.associate = (models) => {
AutomaticPaymentDetails.belongsTo(models.epayRegistration, {
foreignKey: ‘userId’,
targetKey: ‘userId’,
as: ‘e_check_details’,
});
}

EpayRegistration.associate = (models) => {
EpayRegistration.hasMany(models.automaticPaymentDetails, {
foreignKey: ‘userId’,
sourceKey: ‘userId’,
as: ‘paymentDetails’,
});
};

The above example illustrates the e_check_details relationship. Similarly, I want to add the user_case_junction_details relationship, which includes two keys: case_id and user_id.

Sadly Sequelize does not support relationships on Composite keys, see issue on their repository.

The best solution for you would be to create a Smart Relationship and fetch the association yourself.
As shared in the documentation page, the implementation would be different depending on the type of association, belongsTo or HasMany.