stuff
This commit is contained in:
parent
b0b49d1456
commit
f59f214189
2 changed files with 23 additions and 3 deletions
|
|
@ -7,7 +7,6 @@ generator client {
|
|||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model User {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,23 @@
|
|||
import { IsString, IsBoolean, IsArray, IsOptional } from 'class-validator';
|
||||
import { IsString, IsBoolean, IsArray, IsOptional, ValidateNested, IsNumber } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
|
||||
class AnswerDto {
|
||||
@IsString()
|
||||
text: string;
|
||||
|
||||
@IsNumber()
|
||||
points: number;
|
||||
}
|
||||
|
||||
class QuestionDto {
|
||||
@IsString()
|
||||
question: string;
|
||||
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => AnswerDto)
|
||||
answers: AnswerDto[];
|
||||
}
|
||||
|
||||
export class UpdatePackDto {
|
||||
@IsOptional()
|
||||
|
|
@ -19,5 +38,7 @@ export class UpdatePackDto {
|
|||
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
questions?: Array<{ question: string; answer: string }>;
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => QuestionDto)
|
||||
questions?: QuestionDto[];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue