-
Notifications
You must be signed in to change notification settings - Fork 1
Refactor/member #33
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
Refactor/member #33
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion
2
.../team3/kummit/api/MemberBandResponse.java → ...ummit/api/profile/MemberBandResponse.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,4 +1,4 @@ | ||
| package team3.kummit.api; | ||
| package team3.kummit.api.profile; | ||
|
|
||
| import java.util.List; | ||
|
|
||
|
|
||
2 changes: 1 addition & 1 deletion
2
...am3/kummit/api/MemberBandResponseDto.java → ...it/api/profile/MemberBandResponseDto.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
2 changes: 1 addition & 1 deletion
2
...am3/kummit/api/MemberProfileResponse.java → ...it/api/profile/MemberProfileResponse.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,4 +1,4 @@ | ||
| package team3.kummit.api; | ||
| package team3.kummit.api.profile; | ||
|
|
||
| import java.time.LocalDate; | ||
|
|
||
|
|
||
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
45 changes: 45 additions & 0 deletions
45
src/main/java/team3/kummit/controller/parser/MemberApiParser.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,45 @@ | ||
| package team3.kummit.controller.parser; | ||
|
|
||
| import java.util.stream.Collectors; | ||
|
|
||
| import org.springframework.stereotype.Component; | ||
|
|
||
| import team3.kummit.api.profile.MemberBandResponseDto; | ||
| import team3.kummit.api.profile.MemberProfileResponse; | ||
| import team3.kummit.domain.EmotionBand; | ||
| import team3.kummit.domain.Member; | ||
|
|
||
| @Component | ||
| public class MemberApiParser { | ||
|
|
||
| public MemberProfileResponse mapToMemberProfileResponse(Member member){ | ||
| return new MemberProfileResponse( | ||
| member.getName(), | ||
| member.getSignUpDate(), | ||
| member.getBandCreateCount(), | ||
| member.getBandJoinCount(), | ||
| member.getLikeCount(), | ||
| member.getSongAddCount()); | ||
| } | ||
|
|
||
| public MemberBandResponseDto mapToMemberBandResponse(EmotionBand band){ | ||
| return new MemberBandResponseDto( | ||
| band.getEmotion(), | ||
| band.getCreatorName(), | ||
| band.getDescription(), | ||
| band.getSongs().stream() | ||
| .map(song -> new MemberBandResponseDto.Music( | ||
| song.getAlbumImageLink(), | ||
| song.getTitle(), | ||
| song.getArtist(), | ||
| song.getPreviewLink() | ||
| )) | ||
| .collect(Collectors.toList()), | ||
| band.getLikeCount(), | ||
| band.getPeopleCount(), | ||
| band.getSongCount(), | ||
| band.getCommentCount(), | ||
| band.getEndTime() | ||
| ); | ||
| } | ||
| } |
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
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
14 changes: 6 additions & 8 deletions
14
src/test/java/team3/kummit/repository/EmotionBandRepositoryTest.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,30 +1,28 @@ | ||
| package team3.kummit.repository; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.*; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.util.List; | ||
|
|
||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| import org.springframework.beans.factory.annotation.Autowired; | ||
| import org.springframework.boot.test.context.SpringBootTest; | ||
| import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; | ||
|
|
||
| import team3.kummit.domain.EmotionBand; | ||
|
|
||
|
|
||
| @SpringBootTest | ||
| @DataJpaTest | ||
| class EmotionBandRepositoryTest { | ||
|
|
||
| @Autowired | ||
| EmotionBandRepository repository; | ||
|
|
||
| @Test | ||
| void findAllByEmotionBandIdList() { | ||
| List<Long> emotionBandIdListByCreator = repository.findEmotionBandIdListByCreator(1L); | ||
| void findAllByEmotionBandIdListWithSongs() { | ||
| List<Long> emotionBandIdListByCreator = repository.findPkListByCreator(1L); | ||
| } | ||
| @Test | ||
| void indAllByEmotionBandIdList() { | ||
| List<EmotionBand> allByEmotionBandIdList = repository.findAllByEmotionBandIdList(List.of(1L, 2L, 3L), LocalDateTime.now()); | ||
| void findAllByEmotionBandIdList() { | ||
| List<EmotionBand> allByEmotionBandIdList = repository.findAllByEmotionBandIdListWithSongs(List.of(1L, 2L, 3L), LocalDateTime.now()); | ||
| } | ||
| } |
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
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.
PK로 표현을 하시는군요ㅎㅎ
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.
개인적으로 snake_case에 좀 더 익숙한데 camelCase가 길어지면 유난히 더 길어보이고 잘 안읽히는 것 같아요