more sequelize stuff

This commit is contained in:
Ciro Santilli
2021-06-14 21:14:20 +01:00
parent dbf0cbdeae
commit 8c86e0aa4d
8 changed files with 326 additions and 3 deletions

View File

@@ -65,6 +65,7 @@ await Comment.create({body: 'u1c0', UserId: u1.id});
console.log(Object.getOwnPropertyNames(u0));
const u0Comments = await u0.getComments({
include: [{ model: User }],
order: [['id', 'ASC']],
});
assert(u0Comments[0].body === 'u0c0');
assert(u0Comments[1].body === 'u0c1');
@@ -143,6 +144,5 @@ await Comment.create({body: 'u1c0', UserId: u1.id});
//assert(u0Comments[1].author.name === 'u0');
}
}
await sequelize.close();
})();