Skip to content

Commit

Permalink
Merge pull request #5 from Horizontal-org/explanations-order
Browse files Browse the repository at this point in the history
add explanations order
  • Loading branch information
juandans01 authored Jan 18, 2023
2 parents 9b6b868 + c2715b5 commit aed22d4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
18 changes: 18 additions & 0 deletions src/migrations/1673279347037-add_index_to_explanations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {MigrationInterface, QueryRunner, TableColumn} from "typeorm";

export class addIndexToExplanations1673279347037 implements MigrationInterface {

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.addColumn(
"explanations",
new TableColumn({
name: "explanation_index",
type: "varchar",
}),
)
}

public async down(queryRunner: QueryRunner): Promise<void> {
}

}
4 changes: 0 additions & 4 deletions src/modules/question/controllers/list.question.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ export class ListQuestionController {
.leftJoinAndSelect('question.explanations', 'explanations')
.take(10);

console.log(
'🚀 ~ file: list.question.controller.ts:23 ~ ListQuestionController ~ handler ~ apps',
apps,
);
if (apps.length > 0) {
query.where('apps.id IN(:...ids)', { ids: apps });
}
Expand Down
3 changes: 3 additions & 0 deletions src/modules/question/domain/explanation.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export class Explanation {
@PrimaryGeneratedColumn()
id: number;

@Column({ name: 'explanation_index', length: 150 })
index: string;

@Column({ name: 'explanation_position', length: 150 })
position: string;

Expand Down
1 change: 1 addition & 0 deletions src/modules/question/dto/create.question.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export class CreateQuestionDto {
}
explanations?: {
position: string;
index: string;
text: string;
}[]
}

0 comments on commit aed22d4

Please sign in to comment.