add decks crud

This commit is contained in:
2023-06-17 23:27:23 +02:00
parent 9cd6595ae2
commit 36e54cf56f
23 changed files with 405 additions and 35 deletions

View File

@@ -0,0 +1,16 @@
import { IsBoolean, IsOptional, IsString, Length } from 'class-validator'
export class CreateDeckDto {
@Length(3, 30)
name: string
@IsOptional()
@IsString()
cover?: string
@IsOptional()
@IsBoolean()
isPrivate?: boolean
userId: string
}

View File

@@ -0,0 +1,15 @@
import { IsOptional, IsUUID, Length } from 'class-validator'
import { IsOptionalOrEmptyString } from '../../../infrastructure/decorators/is-optional-or-empty-string'
import { PaginationDto } from '../../../infrastructure/common/pagination/pagination.dto'
export class GetAllDecksDto extends PaginationDto {
@IsOptional()
@Length(3, 30)
name?: string
@IsOptionalOrEmptyString()
@IsUUID(4)
authorId?: string
userId: string
}

View File

@@ -0,0 +1,16 @@
import { PartialType } from '@nestjs/mapped-types'
import { CreateDeckDto } from './create-deck.dto'
import { IsOptionalOrEmptyString } from '../../../infrastructure/decorators/is-optional-or-empty-string'
import { IsBoolean } from 'class-validator'
export class UpdateDeckDto extends PartialType(CreateDeckDto) {
@IsOptionalOrEmptyString()
name: string
@IsOptionalOrEmptyString()
@IsBoolean()
isPrivate: boolean
@IsOptionalOrEmptyString()
cover: string
}