This is what i came up with
const result = await this.examTemplateRepo
.createQueryBuilder("examTemplate")
.leftJoinAndSelect("examTemplate.Questions", "questions")
.innerJoin("CurriculumModels", "curriculum", "curriculum.Id = examTemplate.CurriculumId")
.select([
"examTemplate.Id",
"examTemplate.CurriculumId",
"curriculum.Id",
"curriculum.Name",
"questions.Id",
"questions.QuestionTypeId",
"questions.NoOfQuestions",
])
.getMany();
but the result is
[
{
"Id": 1,
"CurriculumId": 1,
"Questions": [
{
"Id": 1,
"QuestionTypeId": 1,
"NoOfQuestions": 10
},
{
"Id": 2,
"QuestionTypeId": 4,
"NoOfQuestions": 10
}
]
}
]
"curriculum.Id", "curriculum.Name", are being hydrated by TypeORM how can i handle this?
result is type of ExamTemplate so i cant exactly loop through the result and re-hydrate the data.
Any advice or suggestions would be greatly appreciated!