feat: add admin tests read and update endpoints
This commit is contained in:
@@ -4,23 +4,23 @@ import { Question } from './question.entity';
|
||||
@Entity()
|
||||
export class Choice {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
id!: number;
|
||||
|
||||
@ManyToOne(() => Question, (question) => question.choices, {
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
question: Question;
|
||||
question!: Question;
|
||||
|
||||
@Column({
|
||||
type: 'varchar',
|
||||
length: 255,
|
||||
nullable: false,
|
||||
})
|
||||
text: string;
|
||||
text!: string;
|
||||
|
||||
@Column({ type: 'int', nullable: false })
|
||||
value: number;
|
||||
value!: number;
|
||||
|
||||
@Column({ type: 'int', nullable: false })
|
||||
order: number;
|
||||
order!: number;
|
||||
}
|
||||
|
||||
@@ -14,35 +14,35 @@ import { Choice } from './choice.entity';
|
||||
@Entity()
|
||||
export class Question {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
id!: number;
|
||||
|
||||
@ManyToOne(() => Test, (test) => test.questions, {
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
test: Test;
|
||||
test!: Test;
|
||||
|
||||
@Column({
|
||||
type: 'enum',
|
||||
enum: QuestionType,
|
||||
default: QuestionType.MULTI_CHOICE,
|
||||
})
|
||||
type: QuestionType;
|
||||
type!: QuestionType;
|
||||
|
||||
@Column({ type: 'text' })
|
||||
content: string;
|
||||
content!: string;
|
||||
|
||||
@Column({ type: 'int', nullable: false })
|
||||
order: number;
|
||||
order!: number;
|
||||
|
||||
@Column({ type: 'boolean', default: true })
|
||||
required: boolean;
|
||||
required!: boolean;
|
||||
|
||||
@Column({ type: 'jsonb', nullable: true })
|
||||
metadata: QuestionMetadata;
|
||||
metadata!: QuestionMetadata;
|
||||
|
||||
@OneToMany(() => Choice, (choice) => choice.question)
|
||||
choices?: Array<Choice>;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
createdAt!: Date;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user