0a9588abb7
- Add pagination support to findAll (page, limit query params) - Add findByTemplateId method to service - Add GET /by-template/:templateId endpoint to controller - Service already includes CRUD for QuestionBank and QuestionBankItem
76 lines
2.1 KiB
TypeScript
76 lines
2.1 KiB
TypeScript
import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm';
|
|
|
|
export class AddTemplateExtensions1773210000002 implements MigrationInterface {
|
|
name = 'AddTemplateExtensions1773210000002';
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
// Add linked_group_ids column
|
|
await queryRunner.addColumn(
|
|
'assessment_templates',
|
|
new TableColumn({
|
|
name: 'linked_group_ids',
|
|
type: 'simple-json',
|
|
isNullable: true,
|
|
}),
|
|
);
|
|
|
|
// Add weight_config column
|
|
await queryRunner.addColumn(
|
|
'assessment_templates',
|
|
new TableColumn({
|
|
name: 'weight_config',
|
|
type: 'simple-json',
|
|
isNullable: true,
|
|
}),
|
|
);
|
|
|
|
// Add difficulty_config column
|
|
await queryRunner.addColumn(
|
|
'assessment_templates',
|
|
new TableColumn({
|
|
name: 'difficulty_config',
|
|
type: 'simple-json',
|
|
isNullable: true,
|
|
}),
|
|
);
|
|
|
|
// Add question_count_min column
|
|
await queryRunner.addColumn(
|
|
'assessment_templates',
|
|
new TableColumn({
|
|
name: 'question_count_min',
|
|
type: 'int',
|
|
default: 8,
|
|
}),
|
|
);
|
|
|
|
// Add question_count_max column
|
|
await queryRunner.addColumn(
|
|
'assessment_templates',
|
|
new TableColumn({
|
|
name: 'question_count_max',
|
|
type: 'int',
|
|
default: 10,
|
|
}),
|
|
);
|
|
|
|
// Add passing_score column
|
|
await queryRunner.addColumn(
|
|
'assessment_templates',
|
|
new TableColumn({
|
|
name: 'passing_score',
|
|
type: 'int',
|
|
default: 90,
|
|
}),
|
|
);
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.dropColumn('assessment_templates', 'linked_group_ids');
|
|
await queryRunner.dropColumn('assessment_templates', 'weight_config');
|
|
await queryRunner.dropColumn('assessment_templates', 'difficulty_config');
|
|
await queryRunner.dropColumn('assessment_templates', 'question_count_min');
|
|
await queryRunner.dropColumn('assessment_templates', 'question_count_max');
|
|
await queryRunner.dropColumn('assessment_templates', 'passing_score');
|
|
}
|
|
} |