feat: add admin tests read and update endpoints
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
Check,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Entity,
|
||||
@@ -12,9 +13,14 @@ import { ResultRange } from '@/modules/scoring/entities/result-range.entity';
|
||||
import { RuleSet } from '@/modules/scoring/entities/rule-set.entity';
|
||||
|
||||
@Entity()
|
||||
@Check(`
|
||||
("price" IS NULL AND "accessType" <> 'paid')
|
||||
OR
|
||||
("price" IS NOT NULL AND "accessType" = 'paid')
|
||||
`)
|
||||
export class Test {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
id!: number;
|
||||
|
||||
@Column({
|
||||
type: 'varchar',
|
||||
@@ -22,42 +28,42 @@ export class Test {
|
||||
nullable: false,
|
||||
unique: true,
|
||||
})
|
||||
title: string;
|
||||
title!: string;
|
||||
|
||||
@Column({
|
||||
type: 'text',
|
||||
nullable: false,
|
||||
})
|
||||
description: string;
|
||||
description!: string;
|
||||
|
||||
@Column({
|
||||
type: 'enum',
|
||||
enum: AccessType,
|
||||
default: AccessType.LOGIN,
|
||||
})
|
||||
accessType: AccessType;
|
||||
accessType!: AccessType;
|
||||
|
||||
@Column({
|
||||
type: 'bigint',
|
||||
nullable: true,
|
||||
})
|
||||
price: string;
|
||||
price!: string;
|
||||
|
||||
@Column({
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
})
|
||||
isActive: boolean;
|
||||
isActive!: boolean;
|
||||
|
||||
@OneToMany(() => Question, (question) => question.test)
|
||||
questions: Array<Question>;
|
||||
questions!: Array<Question>;
|
||||
|
||||
@OneToOne(() => RuleSet, (ruleSet) => ruleSet.test)
|
||||
ruleSet: RuleSet;
|
||||
ruleSet!: RuleSet;
|
||||
|
||||
@OneToMany(() => ResultRange, (range) => range.test)
|
||||
resultRanges: Array<ResultRange>;
|
||||
resultRanges!: Array<ResultRange>;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
createdAt!: Date;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user