mirror of
https://github.com/ershisan99/flashcards-api.git
synced 2025-12-18 05:09:29 +00:00
add decks crud
This commit is contained in:
16
src/modules/decks/dto/create-deck.dto.ts
Normal file
16
src/modules/decks/dto/create-deck.dto.ts
Normal 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
|
||||
}
|
||||
15
src/modules/decks/dto/get-all-decks.dto.ts
Normal file
15
src/modules/decks/dto/get-all-decks.dto.ts
Normal 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
|
||||
}
|
||||
16
src/modules/decks/dto/update-deck.dto.ts
Normal file
16
src/modules/decks/dto/update-deck.dto.ts
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user