-
Notifications
You must be signed in to change notification settings - Fork 0
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
refactor: 회의 진행 후 변경된 요구사항 반영 #74
Changes from 9 commits
035c4ce
9a11033
c51fae1
55977cb
c10a0b8
c253be9
4d9e0eb
3f143d7
51da490
f4b6d97
3817dd8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.atwoz.member.application.auth.dto; | ||
|
||
//TODO 잠깐 테스트 용도로 로그인을 허용하기 위해 만든 dto입니다. 나중에 삭제해야합니다. | ||
public record TestLoginRequest( | ||
String phoneNumber | ||
) { | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,37 @@ | ||
package com.atwoz.member.application.selfintro.dto; | ||
|
||
import jakarta.validation.Valid; | ||
import jakarta.validation.constraints.NotEmpty; | ||
import jakarta.validation.constraints.NotNull; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
public record SelfIntroFilterRequest( | ||
|
||
@NotNull(message = "최소 나이를 입력해주세요") | ||
Integer minAge, | ||
|
||
@NotNull(message = "최대 나이를 입력해주세요") | ||
Integer maxAge, | ||
|
||
@NotNull(message = "성별을 선택해주세요") | ||
Boolean isOnlyOppositeGender, | ||
|
||
@Valid | ||
@NotEmpty(message = "선호 지역을 하나 이상 입력해주세요.") | ||
List<CityRequest> cityRequests | ||
List<String> cities | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 혹시 validator를 쓰지 않고 자체 검증만 하시게 된 이유가 있으실까요? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 필터 기능을 사용할 수도 사용하지 않을수도 있기 때문에 validator로 빈 값에 대한 테스트를 하게 되면 필터를 사용하지 않는 요청이 에러로 나가게 됩니다. 필터를 적용한 페이징 기능과 기존의 페이징 기능을 합쳐서 필터를 사용하지 않는 페이징 요청을 처리하기 위해서 dto에서 유효하지 않는 요청에 대해서만 빈 리스트를 넘겨주는 방식으로 구현했습니다. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 필요에 따라 쓸 수도 있고 쓰지 않을 수도 있기 때문이었군요 이해했습니다 :) |
||
) { | ||
|
||
public List<String> getCities() { | ||
return cityRequests.stream() | ||
.map(CityRequest::city) | ||
.toList(); | ||
public SelfIntroFilterRequest( | ||
final Integer minAge, | ||
final Integer maxAge, | ||
final Boolean isOnlyOppositeGender, | ||
final List<String> cities | ||
) { | ||
this.minAge = minAge; | ||
this.maxAge = maxAge; | ||
this.isOnlyOppositeGender = isOnlyOppositeGender; | ||
this.cities = ensureCities(cities); | ||
} | ||
|
||
private List<String> ensureCities(final List<String> cities) { | ||
if (isInvalidCase(cities)) { | ||
return Collections.emptyList(); | ||
} | ||
return cities; | ||
} | ||
|
||
private boolean isInvalidCase(final List<String> cities) { | ||
return cities == null || | ||
cities.stream() | ||
.allMatch(city -> city == null || city.isBlank()); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저희 그동안 Service를 가장 아래로 하고 그 위에 Transactional을 붙이기로 했던 것 같습니다 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네 수정하겠습니다!