-
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] : Survey 도메인을 kotlin으로 리팩토링한다 #395
Conversation
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.
일단은 기존 도메인에 있던 메서드들 다 있어야될 것 같음.
fun impossible(): domain.feedback.Bookmark = | ||
domain.feedback.Bookmark(bookmarkedAt = TimeUtil.toInstant()) |
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.
지금 정책이 ChoiceFormQuestion (객관식 질문) 에는 북마크할 수 없음. 그래서 이거 표현하려고 해놨어
기능에서 큰 의미가 있지는 않은데, 정책 표현 메소드
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.
음... 잘 모르겠음 표현이 되는건지?
ChoiceFormQuestion는 북마크 할 수 없다.
를 어디서 알 수 있는거임?
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.
null 넣고 bookmark 관련 메서드들 호출되면 무시하거나 에러 발생하게 하는게 더 좋을 것 같은데?
… 변경한다" This reverts commit e2049b1.
src/main/kotlin/me/nalab/api/survey/domain/feedback/Feedback.kt
Outdated
Show resolved
Hide resolved
) { | ||
|
||
companion object { | ||
fun empty(): ImageUrl = ImageUrl("") |
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.
이거도 지금 정책이 "이미지가 없으면 직군별 기본 이미지" 를 내려주는거라서 empty로 만들어놨으
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.
nullable하게 처리하는 건 별루?
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.
기존 코멘트 내용 빼고 요것만 반영하면 될듯
var current = Instant.now() | ||
if (clock != null) { | ||
current = Instant.now(clock) | ||
} |
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.
val로 쓰고 if statement 로 처리하기
var current = Instant.now() | |
if (clock != null) { | |
current = Instant.now(clock) | |
} | |
val current = if (clock == null) Instant.now() else Instant.now(clock) |
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.
return Instant.parse(formatter.format(instant)) | ||
} | ||
|
||
fun fixed(clock: Clock?) { |
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.
fixed 할 때는 not null type으로 받기
fun fixed(clock: Clock?) { | |
fun fixed(clock: Clock) { |
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.
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSSSSX") | ||
.withZone(ZoneId.of("UTC")) |
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.
|
||
private var clock: Clock? = null | ||
|
||
fun toInstant(): Instant { |
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.
now 메서드명 그대로 쓰기?!
fun toInstant(): Instant { | |
fun now(): Instant { |
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.
|
||
@PrePersist | ||
fun prePersist() { | ||
val now = Instant.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.
TimeUtil.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.
|
||
@PreUpdate | ||
fun preUpdate() { | ||
updatedAt = Instant.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.
ditto
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.
어떤 기능을 개발했나요?
Survey 도메인을 kotlin으로 리팩토링 했습니다
어떻게 해결했나요?
기존 도메인 열어보니 Target하나에 여러개의 Survey가 되는거로 구성되어있어서 어그리거트 루트를 Target으로 지정했습니다.
이슈 넘버
참고자료