Sort steps by junction table's column

This commit is contained in:
Takeshi Kimata
2024-03-09 13:27:52 +09:00
parent 548bc43bea
commit 62df98db89
3 changed files with 37 additions and 1 deletions

View File

@@ -20,7 +20,10 @@ module.exports = function (sequelize) {
if (caseId) {
// Include steps if requested using caseId
const testcase = await Case.findByPk(caseId, {
include: Step,
include: [{
model: Step,
through: { attributes: ['stepNo'] },
}],
});
return res.json(testcase);
}