feat: add question transition entity and validators

This commit is contained in:
2026-07-27 16:54:49 +03:30
parent 0fb961ea20
commit bc64643332
13 changed files with 349 additions and 1 deletions
@@ -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,
) {}