You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Controller의 코드는 단 한줄로 간단해졌지만 입력받은 hashtag의 검증을 request DTO에서 하게된다는 단점때문에 DTO본연의 역할을 하지 못하는것 같다는 생각이들고, 또 다른 한편으로는 request를 받는 request DTO에서 입력받은 값에대해 검증을 하는것도 괜찮지않나? 라는 두가지생각이들어 보류중입니다. 이부분은 조금더 고민해봐야겠습니다.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
고민중인 코드입니다. PostRestController에서 if/else로 해시태그 유무에 따라서 PostDto의 해시태그값을 설정해 PostService로 넘기는 상황입니다.
Controller의 역할중 하나는 http프로토콜을 사용한다면 request의 입력값을 검증하고 response 응답을 포맷에 맞게 적절히 내려주는 것이라고 생각했기에 위와 같이 작성했지만 문득 한편으로는 아래와같이 개선해도 괜찮지 않을까? 라는 생각이 들었습니다.
Controller의 코드는 단 한줄로 간단해졌지만 입력받은 hashtag의 검증을 request DTO에서 하게된다는 단점때문에 DTO본연의 역할을 하지 못하는것 같다는 생각이들고, 또 다른 한편으로는 request를 받는 request DTO에서 입력받은 값에대해 검증을 하는것도 괜찮지않나? 라는 두가지생각이들어 보류중입니다. 이부분은 조금더 고민해봐야겠습니다.
Beta Was this translation helpful? Give feedback.
All reactions