Skip to content

Commit 96e6cea

Browse files
committed
WIP doc for dto creation
1 parent 42ee747 commit 96e6cea

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

docs/dto/NEW_DTO.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Create new DTO
2+
## For crud operations
3+
```ts
4+
import { ApiProperty, PartialType } from '@nestjs/swagger'
5+
import { AbstractCustomFieldsDto } from '~/_common/abstracts/dto/abstract.custom-fields.dto'
6+
import { IsMongoId } from 'class-validator'
7+
8+
export class [NAME]CreateDto extends AbstractCustomFieldsDto {
9+
}
10+
11+
export class [NAME]Dto extends [NAME]CreateDto {
12+
@IsMongoId()
13+
@ApiProperty()
14+
public _id: string
15+
}
16+
17+
export class [NAME]UpdateDto extends PartialType([NAME]CreateDto) {
18+
}
19+
```

0 commit comments

Comments
 (0)