feat: add join columns

This commit is contained in:
2026-11-02 14:51:55 +03:30
parent a0801be463
commit 71ce020803
19 changed files with 387 additions and 77 deletions
@@ -41,22 +41,9 @@ export class QuestionsCommandProvider {
public async createOne(createQuestionDto: CreateQuestionDTO) {
const test = await this.testsService.adminGetOne(createQuestionDto.test);
let maxOrder: { max: string } | undefined;
try {
maxOrder = await this.questionsRepository
.createQueryBuilder('q')
.select('MAX(q.order)', 'max')
.where('q.testId = :testId', { testId: test.id })
.getRawOne();
} catch (err) {
throw new AppTimeoutException(err);
}
const newQuestion = this.questionsRepository.create({
...createQuestionDto,
test,
order: (Number(maxOrder?.max) || 0) + 1,
});
try {