-
Notifications
You must be signed in to change notification settings - Fork 0
[refactor] Category, Room 도메인 로직 수정 #61
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
2884a8b
[refactor] Room 도메인 엔티티 내부에 Category 를 밸류 타입으로 선언 (#53)
seongjunnoh ec640ef
[refactor] Room 영속성 adapter 코드 수정 (#53)
seongjunnoh e6d0042
[refactor] category 영속성 코드 삭제 (#53)
seongjunnoh cb037f3
[refactor] 프로덕션 코드 수정 (#53)
seongjunnoh efd040d
[refactor] 테스트 코드 수정 (#53)
seongjunnoh 5bcef7b
[refactor] Category를 enum 타입으로 수정 (#53)
seongjunnoh 9eab0ef
[refactor] 테스트 코드 수정 (#53)
seongjunnoh 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
28 changes: 0 additions & 28 deletions
28
src/main/java/konkuk/thip/room/adapter/out/mapper/CategoryMapper.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
28 changes: 0 additions & 28 deletions
28
...main/java/konkuk/thip/room/adapter/out/persistence/CategoryCommandPersistenceAdapter.java
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
src/main/java/konkuk/thip/room/adapter/out/persistence/CategoryName.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
8 changes: 0 additions & 8 deletions
8
src/main/java/konkuk/thip/room/application/port/out/CategoryCommandPort.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
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,16 +1,35 @@ | ||
| package konkuk.thip.room.domain; | ||
|
|
||
| import konkuk.thip.common.entity.BaseDomainEntity; | ||
| import konkuk.thip.common.exception.InvalidStateException; | ||
| import lombok.Getter; | ||
| import lombok.experimental.SuperBuilder; | ||
| import lombok.RequiredArgsConstructor; | ||
|
|
||
| import java.util.Arrays; | ||
|
|
||
| import static konkuk.thip.common.exception.code.ErrorCode.CATEGORY_NOT_MATCH; | ||
|
|
||
| @Getter | ||
| @SuperBuilder | ||
| public class Category extends BaseDomainEntity { | ||
| @RequiredArgsConstructor | ||
| public enum Category { | ||
|
|
||
| private Long id; | ||
| /** | ||
| * DB에 저장되어 있는 모든 카테고리들의 이름 | ||
| * TODO : DB에서 value를 통해 카테고리를 조회하는것보다 id로 조회하는게 성능상 좋으니, id 값도 같이 보관 ?? | ||
| */ | ||
| SCIENCE_IT("과학/IT"), | ||
| Literature("문학"), | ||
| ART("예술"), | ||
| SOCIAL_SCIENCE("사회과학"), | ||
| HUMANITY("인문학"); | ||
|
|
||
| private String value; | ||
| private final String value; | ||
|
|
||
| private Long aliasId; | ||
| public static Category from(String value) { | ||
| return Arrays.stream(Category.values()) | ||
| .filter(categoryName -> categoryName.getValue().equals(value)) | ||
| .findFirst() | ||
| .orElseThrow( | ||
| () -> new InvalidStateException(CATEGORY_NOT_MATCH) | ||
| ); | ||
| } | ||
| } | ||
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
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
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.
🛠️ Refactor suggestion
enum 상수명의 일관성을 개선해주세요.
enum 상수명이 일관되지 않습니다.
Literature만 PascalCase이고 나머지는 UPPER_SNAKE_CASE입니다.일관성을 위해 다음과 같이 수정하는 것을 권장합니다:
📝 Committable suggestion
🤖 Prompt for AI Agents