feat: add medical test entities
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
import {
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Entity,
|
||||
OneToMany,
|
||||
OneToOne,
|
||||
PrimaryGeneratedColumn,
|
||||
} from 'typeorm';
|
||||
import { AccessType } from '../enums/access-types.enum';
|
||||
import { Question } from '@/modules/questions/entities/question.entity';
|
||||
import { ResultRange } from '@/modules/scoring/entities/result-range.entity';
|
||||
import { RuleSet } from '@/modules/scoring/entities/rule-set.entity';
|
||||
|
||||
@Entity()
|
||||
export class Test {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
|
||||
@Column({
|
||||
type: 'varchar',
|
||||
length: 255,
|
||||
nullable: false,
|
||||
})
|
||||
title: string;
|
||||
|
||||
@Column({
|
||||
type: 'text',
|
||||
nullable: false,
|
||||
})
|
||||
description: string;
|
||||
|
||||
@Column({
|
||||
type: 'enum',
|
||||
enum: AccessType,
|
||||
default: AccessType.LOGIN,
|
||||
})
|
||||
accessType: AccessType;
|
||||
|
||||
@Column({
|
||||
type: 'bigint',
|
||||
nullable: true,
|
||||
})
|
||||
price: string;
|
||||
|
||||
@Column({
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
})
|
||||
isActive: boolean;
|
||||
|
||||
@OneToMany(() => Question, (question) => question.test)
|
||||
questions: Array<Question>;
|
||||
|
||||
@OneToOne(() => RuleSet, (ruleSet) => ruleSet.test)
|
||||
ruleSet: RuleSet;
|
||||
|
||||
@OneToMany(() => ResultRange, (range) => range.test)
|
||||
resultRanges: Array<ResultRange>;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export enum AccessType {
|
||||
FREE = 'free',
|
||||
LOGIN = 'login',
|
||||
PAID = 'paid',
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { Test } from './entities/test.entity';
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([Test])],
|
||||
})
|
||||
export class TestsModule {}
|
||||
Reference in New Issue
Block a user