I have two models, a Session and a Register, with a relation defined as follows:
Session.hasMany(Register, {
foreignKey: {
allowNull: false,
},
});
Register.belongsTo(Session);
I want to get a list of Sessions that the User has registered for, a Register has a foreign key with the User model. With only the UserId how would I get a list of Sessions that have a Register object created by the User?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…