-
Notifications
You must be signed in to change notification settings - Fork 2
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
update :: self-study time #383
Conversation
val allowedTime = selfStudyProperties.allowedTime ?: throw BasicException(ErrorCode.BAD_REQUEST); | ||
val allowedStartTime = LocalTime.parse(allowedTime.split("-")[0]) | ||
val allowedEndTime = LocalTime.parse(allowedTime.split("-")[1]) | ||
|
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.
์ด๊ฑฐ split("-") ๋๋ฒ์ด๋ ํธ์ถํด์ ์ฐ๋๊ฒ ๊ฐ์๋ฐ split("-")์ผ๋ก ๋ฐํ๋ ๊ฒฐ๊ณผ๋ฅผ ๋ณ์๋ก ๋ด์๋๊ณ [0] [1] ์ฐธ์กฐํด์ ์ฐ๋๊ฒ ๋ ๋์๋ณด์ฌ์ ๊ทธ๋ฅ allowedTime์ String[] ๋ณ์๋ก ๋ด์๋๊ณ ์ฐ๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค.
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.
validateCancel ๋ถ๋ถ๋ ๋ง์ฐฌ๊ฐ์ง๊ตฌ์!
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.
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.
๋ฆฌ๋ทฐ ๊ฐ์ฌ๋๋ฆฝ๋๋ค
properties์์ allowedStartTime, allowedEndTime ๋ ๊ฐ์ ๋ฐ๋๋ก ๋ก์ง ์์ ํด๋ณด๊ฒ ์ต๋๋ค
@Configuration | ||
@ConfigurationProperties(prefix = "self-study") | ||
class SelfStudyProperties { | ||
var allowedTime: String? = null |
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.
๊ธฐ๋ณธ๊ฐ์ null๋ก ์ด๊ธฐํํ๊ธฐ๋ณด๋ค๋ ๊ทธ๋ฅ prod ํ๊ฒฝ์์์ ๊ธฐ๋ณธ ๊ฐ์ผ๋ก (8~9์ ์ฌ์ด) ๋๋๊ฒ ์ข์ ๊ฒ ๊ฐ์์. ์๋๋ฉด ๊ทธ๋ฅ ์์ ๊ธฐ๋ณธ๊ฐ์ ๋์ง ๋ง๊ฑฐ๋?
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.
allowedTime์ ์ฐจ๋ผ๋ฆฌ ํ๋๋ง ๋ฐ์์ splitํ์ง๋ง๊ณ properties ์์ฒด์์ allowedStartTime, allowedEndTime ๋๊ฐ๋ฅผ ๋ฐ์์ ์จ๋ ๋ ๊ฒ ๊ฐ์์ ๊ทธ๋ฌ๋ฉด #383 (comment) ์ด ๋ฆฌ๋ทฐ๋ ํด๊ฒฐ๊ฐ๋ฅํ ๊ฒ ๊ฐ์์!
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.
1630ed9
properties์์ allowedStartTime, allowedEndTime์ ๋ฐ์ ์ ์ฒญ ํ์ฉ์๊ฐ์ ์ ํํ๋๋ก ๋ก์ง ๋ณ๊ฒฝํ์ต๋๋ค!
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.
์์ง๋ null๋ก ๊ธฐ๋ณธ๊ฐ์ ๋ฃ์ด๋๊ณ ์๋๋ฐ์? ์์ ๋ถํ๋๋ฆฝ๋๋ค.
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.
@Configuration
@ConfigurationProperties(prefix = "self-study")
class SelfStudyProperties(
val allowedStartTime,
val allowedEndTime
)
์ด๋ฐ์์ผ๋ก์
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.
04b821c
prod ํ๊ฒฝ์์์ ๊ธฐ๋ณธ๊ฐ์ผ๋ก ์ด๊ธฐํํ๊ณ , dev ํ๊ฒฝ์์๋ ๊ฐ์ ์ค๋ฒ๋ผ์ด๋ ํ ์ ์๋๋ก ์์ ํ์์ต๋๋ค
val currentTime = currentTime ?: LocalDateTime.now() | ||
val dayOfWeek = currentTime.dayOfWeek |
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.
currentTime ๊ทธ๋ฅ ํด๋์ค ์์ฑ์๋ก ๋ฐ์ง ๋ง๊ณ ์์ ๋ฒ๋ฆฌ๊ณ validate ํจ์ ํธ์ถ๋๋ ์์ ์ now๋ฅผ ํธ์ถํ๋๊ฒ ์ข์๋ณด์ด๋๋ฐ ์ด๋ป๊ฒ ์๊ฐํ์๋์?
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.
876ccd7
๋ฆฌ๋ทฐ ๋ฐ์ํด์ ๋์ฑ ๊ฐ์ ์์ผ ๋ณด์์ต๋๋ค! ๊ฐ์ฌํฉ๋๋ค
๐ก ๊ฐ์
profile์ด dev์ผ ๋ ์์ต์ ์ฒญ์ด "00:00-23:59"์์ ๋ชจ๋ ๊ฐ๋ฅํ๋๋ก ๋ณ๊ฒฝํ์ต๋๋ค.
๐ ์์ ๋ด์ฉ
ValidDayOfWeekAndHourUtil
์์ selfStudyProperties๊ฐ์ ๋ฐ๋ผ ์์ต์ ์ฒญ์ ๋ค๋ฅด๊ฒ ์ ํํ๋๋ก ์์ ํ์์ต๋๋ค๐ ๋ณ๊ฒฝ์ฌํญ
application-dev.yml
,application-prod.yml
์ self-study allowedTime ์ค์ ์ ์ถ๊ฐํ์์ต๋๋ค