Files
aurak/server/src/migrations/1773210000003-CreateCertificateTable.ts
T
Developer 0a9588abb7 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
2026-04-23 17:19:11 +08:00

79 lines
1.9 KiB
TypeScript

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');
}
}