创建 DTO 的偷懒操作 #3945
wjw-gavin
started this conversation in
General / 闲聊
创建 DTO 的偷懒操作
#3945
Replies: 3 comments 7 replies
-
在 |
Beta Was this translation helpful? Give feedback.
4 replies
-
import { OptionalDto, RequiredDto } from '@mwcp/share'
@czy88840616 看是否需要给 @midway/validate 包增加这两个方法 |
Beta Was this translation helpful? Give feedback.
1 reply
-
@wjw-gavin 注意, 上面两个方法的字段可选/必须属性会与校验属性一致,即
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
在业务中大部分都有
CreateDTO
和UpdateDTO
,如果写了CreateDTO
,有没有什么方法使UpdateDTO
继承CreateDTO
的所有属性,并使其变为可选属性?我写了一个
PartialType
方法继承但是虽说是属性可选了,但是
@Rule
其实还在生效,update 时会校验不通过。请教下大佬怎么修改,或者你们平时都是怎么写的o(╥﹏╥)o
Beta Was this translation helpful? Give feedback.
All reactions