feat: add question transition entity and validators
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsEnum, IsInt, IsOptional, Min } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { QuestionTransitionType } from '../enums/question-transition-type.enum';
|
||||
import type { TransitionConditionType } from '../types/transition-condition.type';
|
||||
|
||||
export class CreateQuestionTransitionDTO {
|
||||
@ApiProperty()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
test!: number;
|
||||
|
||||
@ApiProperty({
|
||||
required: false,
|
||||
nullable: true,
|
||||
})
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
fromQuestion?: number;
|
||||
|
||||
@ApiProperty({
|
||||
required: false,
|
||||
nullable: true,
|
||||
})
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
toQuestion?: number;
|
||||
|
||||
@ApiProperty({
|
||||
enum: QuestionTransitionType,
|
||||
})
|
||||
@IsEnum(QuestionTransitionType)
|
||||
type!: QuestionTransitionType;
|
||||
|
||||
@ApiProperty({
|
||||
required: false,
|
||||
nullable: true,
|
||||
})
|
||||
@IsOptional()
|
||||
conditionValue?: TransitionConditionType;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { PartialType } from '@nestjs/swagger';
|
||||
import { CreateQuestionTransitionDTO } from './create-question-transition.dto';
|
||||
|
||||
export class UpdateQuestionTransitionDTO extends PartialType(
|
||||
CreateQuestionTransitionDTO,
|
||||
) {}
|
||||
Reference in New Issue
Block a user