Sorry for my bad English. I have used fastify for my javascript framework and Postgresql as my database and sequelize as my ORM. But problem occured when i have multiple models.
This is my Code :
// Extract Db
const { student} = this.models
return student.findById(id, {
include: [
{ all: true },
],
limit: 1,
})
The result is :
// Result
{
id: 1,
name: "my beastiful name",
class: "...",
...
// School Object
school: {
id: 23,
name: "My School name",
...
}
}
But what i want is :
// Result
{
// Student Object
student: {
id: 1,
name: "my beastiful name",
class: "...",
...
},
// School Object
school: {
id: 23,
name: "My School name",
...
}
}
Should i use multiple "find" to achive this result.