Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 빈 쪽지 검증 추가 #540

Merged
merged 4 commits into from
Nov 8, 2023
Merged

feat: 빈 쪽지 검증 추가 #540

merged 4 commits into from
Nov 8, 2023

Conversation

zillionme
Copy link
Collaborator

📌 관련 이슈

PR과 연관된 이슈의 번호를 작성해주세요.
closed #527

🛠️ 작업 내용

PR에서 작업한 주요 내용을 적어주세요.

  • 쪽지 등록 시 requestbody로 받는 dto에 빈 쪽지 검증 기능 추가
  • 쪽지 등록 시 쪽지의 내용이 blank면, 예외 발생 테스트

⏳ 작업 시간

추정 시간: 30분
실제 시간: 30분
MethodArgumentTypeMismatchException 때문에 삽질 2시간 추가..

Copy link
Contributor

github-actions bot commented Nov 6, 2023

Unit Test Results

188 tests   188 ✔️  16s ⏱️
  36 suites      0 💤
  36 files        0

Results for commit 03443e8.

♻️ This comment has been updated with latest results.

@zillionme zillionme self-assigned this Nov 6, 2023
@zillionme zillionme added 🍀 백엔드 백엔드 라벨 D-1 labels Nov 6, 2023
Copy link
Collaborator

@dooboocookie dooboocookie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굳이네요!!
별다른 RC를 드릴게 없어서 바로 어푸루부 할게요!!

@@ -28,7 +28,8 @@ public ResponseEntity<ExceptionResponse> handleBaseException(final BaseException
@ExceptionHandler({
HttpMessageNotReadableException.class,
MethodArgumentNotValidException.class,
HttpMediaTypeNotSupportedException.class})
HttpMediaTypeNotSupportedException.class,
MethodArgumentNotValidException.class})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P5:

이건 추후에 바뀔 수도 있는 부분이네요.

아직 API 명세상으로
image

'요청 바디가 잘못됐을 때'로 퉁쳐져 있는데,
이런 특정 도메인 규칙이 있는 예외는 다른 에러 코드로 내려갈 수 있을 것 같아요!

@@ -34,7 +36,7 @@ public LetterController(final LetterService letterService) {

@PostMapping
public ResponseEntity<LetterResponse> createLetter(@Auth final PlayerRequest playerRequest,
@RequestBody final LetterRequest letterRequest) {
@Valid @RequestBody final LetterRequest letterRequest) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P5:

저도 해당 부분에 @Valid를 사용하는 것에 대해서 매우 동의합니다.

https://mangkyu.tistory.com/174

혹시나 해서 @Valid@validated의 차이도 인지하고 있으면 좋을 것 같아요!!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

루카 좋은 자료 감사합니당


@ParameterizedTest
@ValueSource(strings = {"", " "})
void 쪽지_등록_요청시_쪽지의_내용이_blank이면_예외가_발생한다(String message) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

테스트 굳

Copy link
Collaborator

@chaewon121 chaewon121 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이레! 빈칸테스크 가져가주셧군요 감사합니다~!
MethodArgumentTypeMismatchException 이거 분노포인트 인정
특별히 수정할 부분없어서 바로 approve하겟습니다~!

@@ -34,7 +36,7 @@ public LetterController(final LetterService letterService) {

@PostMapping
public ResponseEntity<LetterResponse> createLetter(@Auth final PlayerRequest playerRequest,
@RequestBody final LetterRequest letterRequest) {
@Valid @RequestBody final LetterRequest letterRequest) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

루카 좋은 자료 감사합니당

Comment on lines 352 to 356


@ParameterizedTest
@ValueSource(strings = {"", " "})
void 쪽지_등록_요청시_쪽지의_내용이_blank이면_예외가_발생한다(String message) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이레짱 꼼꼼쓰

@@ -28,7 +28,8 @@ public ResponseEntity<ExceptionResponse> handleBaseException(final BaseException
@ExceptionHandler({
HttpMessageNotReadableException.class,
MethodArgumentNotValidException.class,
HttpMediaTypeNotSupportedException.class})
HttpMediaTypeNotSupportedException.class,
MethodArgumentNotValidException.class})
Copy link
Collaborator

@chaewon121 chaewon121 Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3: @Valid가 던지는 에러가 MethodArgumentNotValidException 인데 지금 중복이네요! 하나지워도 될것같아요!

…23-naaga into feat/#527

� Conflicts:
�	backend/src/main/java/com/now/naaga/letter/presentation/LetterController.java
�	backend/src/test/java/com/now/naaga/letter/presentation/LetterControllerTest.java
@dooboocookie dooboocookie merged commit 1056f33 into dev_backend Nov 8, 2023
3 checks passed
@dooboocookie dooboocookie deleted the feat/#527 branch November 8, 2023 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D-1 🍀 백엔드 백엔드 라벨
Projects
Status: 완료
Development

Successfully merging this pull request may close these issues.

3 participants