-
Notifications
You must be signed in to change notification settings - Fork 3
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: 패키지 구조 정리 및 추천 알고리즘 추상화 #454
Open
0chil
wants to merge
8
commits into
backend
Choose a base branch
from
refactor/add-aggregate-2
base: backend
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4c84cb2
refactor: Member에서 MemberGenre 분리
thdwoqor ced8821
feat: 멤버 장르 Id를 UUID로 변경
thdwoqor 2a897a4
refactor: ddl-auto 옵션 변경
thdwoqor a15d679
feat: 예외 처리 및 주입받고있는 service를 repository로 변경
thdwoqor fca2310
remove: dislikeRooms 삭제
thdwoqor 8d8b396
refactor: 패키지 이동
thdwoqor 433fa53
test: 멤버 장르 가중치 테스트 작성
thdwoqor 244a2fd
refactor: 추천 알고리즘을 추상화한다. (#443)
Songusika 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 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
2 changes: 1 addition & 1 deletion
2
backend/src/main/java/com/digginroom/digginroom/admin/controller/dto/UploadRequest.java
This file contains 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
2 changes: 1 addition & 1 deletion
2
backend/src/main/java/com/digginroom/digginroom/controller/RoomController.java
This file contains 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
29 changes: 29 additions & 0 deletions
29
backend/src/main/java/com/digginroom/digginroom/domain/UUIDBaseEntity.java
This file contains 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,29 @@ | ||
package com.digginroom.digginroom.domain; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.EntityListeners; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.MappedSuperclass; | ||
import java.time.LocalDateTime; | ||
import java.util.UUID; | ||
import lombok.Getter; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.annotation.LastModifiedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
@Getter | ||
@MappedSuperclass | ||
@EntityListeners(AuditingEntityListener.class) | ||
public abstract class UUIDBaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.UUID) | ||
private UUID id; | ||
@CreatedDate | ||
@Column(updatable = false) | ||
private LocalDateTime createdAt; | ||
@LastModifiedDate | ||
private LocalDateTime updatedAt; | ||
} |
39 changes: 0 additions & 39 deletions
39
backend/src/main/java/com/digginroom/digginroom/domain/member/DislikeRooms.java
This file was deleted.
Oops, something went wrong.
This file contains 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
37 changes: 0 additions & 37 deletions
37
backend/src/main/java/com/digginroom/digginroom/domain/member/MemberGenre.java
This file was deleted.
Oops, something went wrong.
41 changes: 0 additions & 41 deletions
41
backend/src/main/java/com/digginroom/digginroom/domain/member/MemberGenres.java
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...om/digginroom/domain/member/Nickname.java → ...digginroom/domain/member/vo/Nickname.java
This file contains 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
2 changes: 1 addition & 1 deletion
2
...om/digginroom/domain/member/Password.java → ...digginroom/domain/member/vo/Password.java
This file contains 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
2 changes: 1 addition & 1 deletion
2
...om/digginroom/domain/member/Provider.java → ...digginroom/domain/member/vo/Provider.java
This file contains 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: 8 additions & 0 deletions
8
backend/src/main/java/com/digginroom/digginroom/domain/recommend/GenreRecommender.java
This file contains 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,8 @@ | ||
package com.digginroom.digginroom.domain.recommend; | ||
|
||
import com.digginroom.digginroom.domain.room.Genre; | ||
|
||
public interface GenreRecommender { | ||
|
||
Genre recommend(final Long memberId); | ||
} | ||
33 changes: 33 additions & 0 deletions
33
...rc/main/java/com/digginroom/digginroom/domain/recommend/RandomInGenreRoomRecommender.java
This file contains 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.digginroom.digginroom.domain.recommend; | ||
|
||
import com.digginroom.digginroom.domain.room.Genre; | ||
import com.digginroom.digginroom.domain.room.Room; | ||
import com.digginroom.digginroom.exception.RecommendException.NoRecommendableRoomException; | ||
import com.digginroom.digginroom.repository.RoomRepository; | ||
import java.util.List; | ||
import java.util.concurrent.ThreadLocalRandom; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class RandomInGenreRoomRecommender implements RoomRecommender { | ||
|
||
private final RoomRepository roomRepository; | ||
private final GenreRecommender genreRecommender; | ||
|
||
@Override | ||
public Long recommend(final Long memberId) { | ||
Genre recommenedGenre = genreRecommender.recommend(memberId); | ||
return recommendRoom(recommenedGenre).getId(); | ||
} | ||
|
||
private Room recommendRoom(final Genre recommendedGenre) { | ||
List<Room> rooms = roomRepository.findByTrackSuperGenre(recommendedGenre); | ||
if (rooms.isEmpty()) { | ||
throw new NoRecommendableRoomException(recommendedGenre.getName()); | ||
} | ||
int pickedIndex = ThreadLocalRandom.current().nextInt(rooms.size()); | ||
return rooms.get(pickedIndex); | ||
} | ||
} |
Oops, something went wrong.
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.
👍