-
Notifications
You must be signed in to change notification settings - Fork 1
[REFACTOR] 타임박스 도메인, 엔티티 분리 - 파일 네이밍 수정 외 3개 #200
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1561859
refactor: `XXX` 네이밍을 `XXXEntity` 로 변경
leegwichan a6dac5f
refactor(CustomizeTimeBox): `XXXDomain` 네이밍을 `XXX` 로 변경
leegwichan f8edd92
feat(Bell) : Bell 도메인 객체 생성
leegwichan 1e88c2a
feat: CustomizeTimeBox 에서 Bell 정보를 가져올 수 있도록 변경
leegwichan da0f961
feat: Controller DTO <-> Domain 전환 로직 구현
leegwichan 2a9c992
fix: CustomizeTimeBoxEntity 의 누락된 테이블 이름 설정
leegwichan 7f890d3
test(Bell): 테스트 케이스 추가
leegwichan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| package com.debatetimer.domain.customize; | ||
|
|
||
| import com.debatetimer.exception.custom.DTClientErrorException; | ||
| import com.debatetimer.exception.errorcode.ClientErrorCode; | ||
| import lombok.Getter; | ||
|
|
||
| @Getter | ||
| public class Bell { | ||
|
|
||
| public static final int MAX_BELL_COUNT = 3; | ||
|
|
||
| private final int time; | ||
| private final int count; | ||
|
|
||
| public Bell(int time, int count) { | ||
| validateTime(time); | ||
| validateCount(count); | ||
| this.time = time; | ||
| this.count = count; | ||
| } | ||
|
|
||
| private void validateTime(int time) { | ||
| if (time < 0) { | ||
| throw new DTClientErrorException(ClientErrorCode.INVALID_BELL_TIME); | ||
| } | ||
| } | ||
|
|
||
| private void validateCount(int count) { | ||
| if (count <= 0 || count > MAX_BELL_COUNT) { | ||
| throw new DTClientErrorException(ClientErrorCode.INVALID_BELL_COUNT); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/com/debatetimer/domain/customize/CustomizeTimeBoxEntities.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package com.debatetimer.domain.customize; | ||
|
|
||
| import com.debatetimer.entity.customize.CustomizeTimeBoxEntity; | ||
| import java.util.Comparator; | ||
| import java.util.List; | ||
| import lombok.Getter; | ||
|
|
||
| @Getter | ||
| public class CustomizeTimeBoxEntities { | ||
|
|
||
| private static final Comparator<CustomizeTimeBoxEntity> TIME_BOX_COMPARATOR = Comparator | ||
| .comparing(CustomizeTimeBoxEntity::getSequence); | ||
|
|
||
| private final List<CustomizeTimeBoxEntity> timeBoxes; | ||
|
|
||
| public CustomizeTimeBoxEntities(List<CustomizeTimeBoxEntity> timeBoxes) { | ||
| this.timeBoxes = timeBoxes.stream() | ||
| .sorted(TIME_BOX_COMPARATOR) | ||
| .toList(); | ||
| } | ||
| } | ||
21 changes: 0 additions & 21 deletions
21
src/main/java/com/debatetimer/domain/customize/CustomizeTimeBoxes.java
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/main/java/com/debatetimer/dto/customize/request/BellRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,13 @@ | ||
| package com.debatetimer.dto.customize.request; | ||
|
|
||
| import com.debatetimer.domain.customize.Bell; | ||
|
|
||
| public record BellRequest( | ||
| int time, | ||
| int count | ||
| ) { | ||
|
|
||
| public Bell toDomain() { | ||
| return new Bell(time, count); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/main/java/com/debatetimer/dto/customize/response/BellResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,13 @@ | ||
| package com.debatetimer.dto.customize.response; | ||
|
|
||
| import com.debatetimer.domain.customize.Bell; | ||
|
|
||
| public record BellResponse( | ||
| int time, | ||
| int count | ||
| ) { | ||
|
|
||
| public BellResponse(Bell bell) { | ||
| this(bell.getTime(), bell.getCount()); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
음... 이건 좀 궁금하네요. entity의 일급 컬렉션을 domain에 위치시킨 이유가 뭔가요?
이건 저도 확신이 안서서 적은 질문입니다
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.
그게... 지금 해당 객체가 가지고 있는게 Entity 거덩요? 그런데 얘가 지금 ServiceV1에서는 도메인처럼 사용되고 있어요.
그래서 얘를 엔티티로 옮길까 하다가 (어짜피 곧 지워질 거기도 하고... 지금 ServiceV1에서는 도메인으로 쓰이기도 하고...) 일단 냅뒀습니다. 그래도 V2에서 사용하는 객체와 구분하기 위해서 이름은 바꿨습니다.
해당 부분은 V1까지 중복적으로 가지고 가다가, V2 적용 시점에 지울 것 같습니다. 구분을 위한 더 좋은 대안이 있다면 알려주세요!