many to many (through model, with extra field in junction table) error "<Model1> is not associated to <Model2>"
See original GitHub issueHi. I’m new in feathersj , sequelize and web. So i’m trying to create simple first app and i need some backend for it. Now about the current problem: I have 3 sequelize models - receipts,ingredients and receiptsIngredients You can see all code here (hooks, models, associations etc.) https://github.com/kk4fun/feathers-server-receiptsmania
So , when i send get request in postman i get an error:
{
"name": "GeneralError",
"message": "ingredients is not associated to receipts!",
"code": 500,
"className": "general-error",
"data": {},
"errors": {}
}
And there’s one note: in postgres.js file here, where associations are set i don’t see this log. But it auto-generated feathers code. May be it helps.
Object.keys(models).forEach(name => {
if ('associate' in models[name]) {
console.log('!!!');
models[name].associate(models);
}
});
And i don’t understand now what is wrong and why i can’t see receipts with ingredients throw receipts service with sequelize include before hook. Help me, please 😃
======================================= I’m doing it on Windows 10 x64, in VS code editor.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:6
Top GitHub Comments
That looks like a DB error, and not from postman.
Since you are new to web development, wouldn’t it be a better learning experience to start with the straightforward NeDB DB rather than with the complexity of Sequelize?
If you insist on Sequelize, I suggest you look at bestbuy/api-playground and feathersjs/api-playground-client
Yes, i agree. Thanks a lot.