forked from hangshuo652/aurak
e782d180d7
- Add judgment and followupHints fields to QuestionBankItem entity - Rewrite generateQuestions prompt for 3:7 choice:open ratio - Extract parseGeneratedQuestion function with type-aware parsing - Add 29 unit tests: 14 prompt content + 15 parse logic - Total: 97 tests passing (59 baseline + 38 new)
110 lines
2.4 KiB
TypeScript
110 lines
2.4 KiB
TypeScript
import {
|
|
Entity,
|
|
PrimaryGeneratedColumn,
|
|
Column,
|
|
CreateDateColumn,
|
|
UpdateDateColumn,
|
|
ManyToOne,
|
|
JoinColumn,
|
|
} from 'typeorm';
|
|
import { QuestionBank } from './question-bank.entity';
|
|
|
|
export enum QuestionBankItemStatus {
|
|
PENDING_REVIEW = 'PENDING_REVIEW',
|
|
PUBLISHED = 'PUBLISHED',
|
|
}
|
|
|
|
export enum QuestionType {
|
|
SHORT_ANSWER = 'SHORT_ANSWER',
|
|
MULTIPLE_CHOICE = 'MULTIPLE_CHOICE',
|
|
TRUE_FALSE = 'TRUE_FALSE',
|
|
}
|
|
|
|
export enum QuestionDifficulty {
|
|
STANDARD = 'STANDARD',
|
|
ADVANCED = 'ADVANCED',
|
|
SPECIALIST = 'SPECIALIST',
|
|
}
|
|
|
|
export enum QuestionDimension {
|
|
PROMPT = 'PROMPT',
|
|
LLM = 'LLM',
|
|
IDE = 'IDE',
|
|
DEV_PATTERN = 'DEV_PATTERN',
|
|
WORK_CAPABILITY = 'WORK_CAPABILITY',
|
|
}
|
|
|
|
@Entity('question_bank_items')
|
|
export class QuestionBankItem {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id: string;
|
|
|
|
@Column({ name: 'bank_id' })
|
|
bankId: string;
|
|
|
|
@ManyToOne(
|
|
() => QuestionBank,
|
|
(bank: QuestionBank) => bank.items,
|
|
{ onDelete: 'CASCADE' },
|
|
)
|
|
@JoinColumn({ name: 'bank_id' })
|
|
bank: QuestionBank;
|
|
|
|
@Column({ type: 'text', name: 'question_text' })
|
|
questionText: string;
|
|
|
|
@Column({
|
|
type: 'simple-enum',
|
|
enum: QuestionType,
|
|
default: QuestionType.SHORT_ANSWER,
|
|
})
|
|
questionType: QuestionType;
|
|
|
|
@Column({ type: 'simple-json', nullable: true })
|
|
options: string[] | null;
|
|
|
|
@Column({ type: 'text', nullable: true })
|
|
correctAnswer: string | null;
|
|
|
|
@Column({ type: 'simple-json', name: 'key_points' })
|
|
keyPoints: string[];
|
|
|
|
@Column({
|
|
type: 'simple-enum',
|
|
enum: QuestionDifficulty,
|
|
default: QuestionDifficulty.STANDARD,
|
|
})
|
|
difficulty: QuestionDifficulty;
|
|
|
|
@Column({
|
|
type: 'simple-enum',
|
|
enum: QuestionDimension,
|
|
default: QuestionDimension.PROMPT,
|
|
})
|
|
dimension: QuestionDimension;
|
|
|
|
@Column({ type: 'text', nullable: true })
|
|
basis: string | null;
|
|
|
|
@Column({ type: 'text', nullable: true })
|
|
judgment: string | null;
|
|
|
|
@Column({ type: 'simple-json', nullable: true, name: 'followup_hints' })
|
|
followupHints: string[] | null;
|
|
|
|
@Column({ name: 'created_by', nullable: true, type: 'text' })
|
|
createdBy: string | null;
|
|
|
|
@Column({
|
|
type: 'simple-enum',
|
|
enum: QuestionBankItemStatus,
|
|
default: QuestionBankItemStatus.PENDING_REVIEW,
|
|
})
|
|
status: QuestionBankItemStatus;
|
|
|
|
@CreateDateColumn({ name: 'created_at' })
|
|
createdAt: Date;
|
|
|
|
@UpdateDateColumn({ name: 'updated_at' })
|
|
updatedAt: Date;
|
|
} |