feat: implement QuestionBank CRUD with pagination and template query

- 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
This commit is contained in:
Developer
2026-04-23 17:19:11 +08:00
commit 0a9588abb7
492 changed files with 112453 additions and 0 deletions
@@ -0,0 +1,79 @@
import { MigrationInterface, QueryRunner, Table } from 'typeorm';
export class CreateAssessmentCertificateTable1773210000003 implements MigrationInterface {
name = 'CreateAssessmentCertificateTable1773210000003';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.createTable(
new Table({
name: 'assessment_certificates',
columns: [
{
name: 'id',
type: 'uuid',
isPrimary: true,
generationStrategy: 'uuid',
isGenerated: true,
},
{
name: 'user_id',
type: 'uuid',
isNullable: false,
},
{
name: 'session_id',
type: 'uuid',
isNullable: false,
},
{
name: 'template_id',
type: 'uuid',
isNullable: false,
},
{
name: 'level',
type: 'varchar',
length: '50',
isNullable: false,
},
{
name: 'total_score',
type: 'float',
isNullable: false,
},
{
name: 'qr_code',
type: 'varchar',
length: '255',
isNullable: true,
},
{
name: 'dimension_scores',
type: 'simple-json',
isNullable: true,
},
{
name: 'radar_data',
type: 'simple-json',
isNullable: true,
},
{
name: 'passed',
type: 'boolean',
default: false,
},
{
name: 'issued_at',
type: 'timestamp',
default: 'now()',
},
],
}),
true,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropTable('assessment_certificates');
}
}