-
Notifications
You must be signed in to change notification settings - Fork 2
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
127 feat 인기 포트폴리오 방식 변경 #128
Open
kcsc2217
wants to merge
9
commits into
develop
Choose a base branch
from
127-feat-인기-포트폴리오-방식-변경
base: develop
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.
The head ref may contain hidden characters: "127-feat-\uC778\uAE30-\uD3EC\uD2B8\uD3F4\uB9AC\uC624-\uBC29\uC2DD-\uBCC0\uACBD"
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
860ee17
feat: 포트폴리오 전체조회시 좋아요 여부 반영
kcsc2217 6d5be77
feat: 인기 포폴 방식 변경 및 유저 좋아요 여부 반영
kcsc2217 6f219d3
fix 코드 리팩터링
kcsc2217 ef19e78
fix 코드 리팩터링
kcsc2217 ce41cac
feat: 저장소 Map에서 Redis String 으로 변경
kcsc2217 f0a5132
fix: 저장소 redis 변경 후 테스트 코드 수정
kcsc2217 5225604
feat: 인기 포트폴리오 방식 zset_>List 방식으로 변경
kcsc2217 9fca161
tset: 포트폴리오 테스틐 코드 작성
kcsc2217 7a05aec
feat: 포폴과 같은 방식으로 인기 게더링
kcsc2217 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
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
86 changes: 86 additions & 0 deletions
86
src/main/java/com/palettee/gathering/controller/dto/Response/GatheringPopularResponse.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,86 @@ | ||
package com.palettee.gathering.controller.dto.Response; | ||
|
||
import com.palettee.gathering.domain.Gathering; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
public class GatheringPopularResponse { | ||
private Long gatheringId; | ||
private Long userId; | ||
private String sort; | ||
private int person; | ||
private String subject; | ||
private String title; | ||
private String deadLine; | ||
private String username; | ||
private List<String> tags; | ||
private List<String> positions; | ||
private Double score; | ||
private boolean isLiked; | ||
|
||
public GatheringPopularResponse(Long gatheringId, String sort, Long userId, String subject, int person, String title, List<String> positions, Double score, String deadLine, String username, List<String> tags) { | ||
this.gatheringId = gatheringId; | ||
this.sort = sort; | ||
this.userId = userId; | ||
this.subject = subject; | ||
this.person = person; | ||
this.title = title; | ||
this.positions = positions; | ||
this.score = score; | ||
this.deadLine = deadLine; | ||
this.username = username; | ||
this.tags = tags; | ||
} | ||
|
||
public static GatheringPopularResponse toDto(Gathering gathering, Double score) { | ||
|
||
String deadLine = gathering.getDeadLine().toString(); | ||
|
||
List<String> gatheringTagList = checkGatheringTag(gathering); | ||
|
||
List<String> positions = gatheringPositions(gathering); | ||
|
||
|
||
return new GatheringPopularResponse( | ||
gathering.getId(), | ||
gathering.getSort().getSort(), | ||
gathering.getUser().getId(), | ||
gathering.getSubject().getSubject(), | ||
gathering.getPersonnel(), | ||
gathering.getTitle(), | ||
positions, | ||
score, | ||
deadLine, | ||
gathering.getUser().getName(), | ||
gatheringTagList | ||
); | ||
} | ||
|
||
|
||
private static List<String> checkGatheringTag(Gathering gathering) { | ||
if(gathering.getGatheringTagList() != null && !gathering.getGatheringTagList().isEmpty()){ | ||
return gathering.getGatheringTagList().stream() | ||
.map(gatheringTag -> gathering.getContent()).toList(); | ||
} | ||
return null; | ||
} | ||
|
||
private static List<String> gatheringPositions(Gathering gathering) { | ||
|
||
if(gathering.getPositions() != null && !gathering.getPositions().isEmpty()) { | ||
List<String> positionList = gathering.getPositions() | ||
.stream() | ||
.map(position -> position.getPositionContent().getPosition()) | ||
.toList(); | ||
return positionList; | ||
} | ||
return null; | ||
} | ||
|
||
} |
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
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
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
This file was deleted.
Oops, something went wrong.
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.
Const 이용해서 전역 변수로 처리하면 좋을 것 같아요!!