-
Notifications
You must be signed in to change notification settings - Fork 1
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
๐ ๋ ์ง ์ถ๋ ฅ ํํ ๋ณ๊ฒฝ #78
base: feature
Are you sure you want to change the base?
Conversation
๐ Jacoco ํ ์คํธ ๊ฒฐ๊ณผ
|
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.
์ด๊ฑฐ ์๋ง WebMvcConfig.java์ ์ค์๋ก @EnableWebMvc
๋๋ฌธ์ผ ๊ฒ ๊ฐ์ต๋๋ค. ํด๋น ์ ๋ํ
์ด์
์ ์ง์ฐ๊ณ ๋ค์ ํด๋ณด์ค ์ ์๋์??
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.
ํ๋ ๊ณ ์ํ์
จ์ต๋๋ค~
์๊ฐํด๋ณผ ์ฃผ์ ๊ฐ ์กฐ๊ธ ์๋ค์!
public static LocalDate parseToDate(String date, ErrorCode errorCode) { | ||
notMatching(date, DATE_FORMAT, errorCode); | ||
|
||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_PATTERN); | ||
|
||
try { | ||
return LocalDate.parse(date, formatter); | ||
} catch (DateTimeParseException e) { | ||
throw new BadRequestException(errorCode); | ||
} | ||
} |
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.
date
๋ฅผ ๋ฐ์์ localDate
๋ก ๋ด๋ณด๋ด์ ๊ทธ๋ฐ์ง parseToDate
๋ฉ์๋ ๋ช
์ด ์กฐ๊ธ ์ด์ํ ๊ฒ ๊ฐ์๋ฐ์?
public record InfoResponse( | ||
Long userId, | ||
String nickname, | ||
String profileImg, | ||
Integer height, | ||
Integer weight, | ||
LocalDate birthDate, | ||
String birthDate, | ||
Sex sex, | ||
ExerciseIntensity exerciseIntensity | ||
) { |
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.
์ด๊ฒ๋ swagger ์๊ฐ์ ํด๋ณด๋ฉด ์ด๋ป๊ฒ ๊ตฌ์ฒด์ ์ผ๋ก ์ ์ ์ ์์ ์ง ๊ณ ๋ฏผํด๋ด์ผ๊ฒ ๋ค์
public static String parseToString(LocalDate date, ErrorCode errorCode) { | ||
try { | ||
return date.format(formatter); | ||
} catch (DateTimeParseException e) { | ||
throw new BaseException(errorCode); | ||
} | ||
} |
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.
Validator
๊ฐ parse๋ฅผ ํ๋๋ก ์ฑ
์์ ๋ถ์ฌํด๋ ๋ ์ง ์๊ฐํด๋ด์ผ ํ ๊ฒ ๊ฐ์์
๐ซ ๊ด๋ จ ์ด์
๐ ์ฃผ์ ๋ณ๊ฒฝ์ฌํญ
DateValidator์ ๋ฉ์๋๋ฅผ ์ถ๊ฐํ์ฌ ๋ณ๊ฒฝ ๋ฐ format ๊ฒ์ฌ ์งํ
๐ก ๊ธฐํ์ฌํญ