-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Feat] 마이페이지 인사이트 조회 #159
[Feat] 마이페이지 인사이트 조회 #159
Changes from 3 commits
5fdb24e
02ff126
01fcecc
b9913cd
d45146b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package ccc.keeweapi.dto.insight; | ||
|
||
import ccc.keewedomain.persistence.domain.common.Link; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor(staticName = "of") | ||
public class InsightMyPageResponse { | ||
private Long id; | ||
private String contents; | ||
private Link link; | ||
private ReactionAggregationResponse reaction; | ||
private String createdAt; | ||
private boolean isBookmark; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package ccc.keewedomain.dto.insight; | ||
|
||
import ccc.keewedomain.persistence.domain.common.Link; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@AllArgsConstructor(staticName = "of") | ||
public class InsightMyPageDto { | ||
private Long id; | ||
private String contents; | ||
private Link link; | ||
private ReactionAggregationGetDto reaction; | ||
private LocalDateTime createdAt; | ||
private boolean isBookmark; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,6 @@ | |
import org.springframework.transaction.annotation.Transactional; | ||
import java.time.LocalDateTime; | ||
import java.util.Arrays; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
|
@@ -177,6 +176,22 @@ public Long getThisWeekCount(ChallengeParticipation participation, LocalDateTime | |
return insightQueryRepository.countByParticipationBetween(participation, startDate, endDate); | ||
} | ||
|
||
@Transactional(readOnly = true) | ||
public List<InsightMyPageDto> getByUserId(User user, Long targetUserId, Long drawerId, CursorPageable<Long> cPage) { | ||
List<Insight> insights = insightQueryRepository.findByUserIdAndDrawerId(targetUserId, drawerId, cPage); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. List를 가져오는것과 단일객체를 가져올때 네이밍 구분이 명확했음 좋겠어요 이름은 userId로만 가져오는 것처럼 단순해보이지만 실제 파라미터는 너무 많아서 그렇지 않은거같기도하구요.ㅎ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 서랍이 추가되기도 하면서 이름이 알맞지 않아보이네요 |
||
Map<Long, Boolean> bookmarkPresenceMap = bookmarkQueryRepository.getBookmarkPresenceMap(user, insights); | ||
return insights.parallelStream() | ||
.map(insight -> InsightMyPageDto.of( | ||
insight.getId(), | ||
insight.getContents(), | ||
insight.getLink(), | ||
getReactionAggregation(insight.getId()), | ||
insight.getCreatedAt(), | ||
bookmarkPresenceMap.getOrDefault(insight.getId(), false) | ||
)) | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
/***************************************************************** | ||
********************** private 메소드 영역 분리 ********************* | ||
*****************************************************************/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
JAR_DIR='/home/ubuntu/'$2 | ||
|
||
cp keewe-batch/build/libs/keewe-batch-0.0.1-SNAPSHOT.jar ${JAR_DIR}/ | ||
|
||
echo "> Auto batch deploy starting...." | ||
|
||
mkdir $JAR_DIR | ||
mkdir -p $JAR_DIR | ||
cd $JAR_DIR | ||
|
||
ORIGIN_JAR_PATH= "${JAR_DIR}/*.jar" | ||
chmod 770 ${JAR_DIR}/$1-0.0.1-SNAPSHOT.jar | ||
ORIGIN_JAR_PATH="${JAR_DIR}/$1-0.0.1-SNAPSHOT.jar" | ||
ORIGIN_JAR_NAME=$(basename ${ORIGIN_JAR_PATH}) | ||
TARGET_PATH="${JAR_DIR}/batch-application.jar" | ||
|
||
echo "> Do deploy :: $1" | ||
echo " > 배포 JAR: "${ORIGIN_JAR_NAME} | ||
|
||
echo " > sudo ln -s -f ${JAR_DIR}${ORIGIN_JAR_NAME} ${TARGET_PATH}" | ||
sudo ln -s -f ${JAR_DIR}${ORIGIN_JAR_NAME} ${TARGET_PATH} | ||
echo " > sudo ln -s -f ${JAR_DIR}/${ORIGIN_JAR_NAME} ${TARGET_PATH}" | ||
ln -s -f "${JAR_DIR}/${ORIGIN_JAR_NAME} ${TARGET_PATH}" | ||
|
||
echo "> Batch deploy Complete ! !" | ||
echo "> Batch deploy Complete ! !" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. JAR_DIR /로 끝나면 잘되나요?ㅎㅋ There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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.
drawerId가 Null인 케이스는 서랍 탭 중에 전체인 경우죠?
그럼 조건이 equal null로 들어가면 전체 조회가 안되지 않을까여?
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.
네 drawerId가 null이면 전체인 경우에요
저렇게 사용하면 drawerId가 null인 경우 and(null)로 들어가면 파라미터가 null로 들어가서 조건문에서 제외돼요.
그래서 drawerId가 null인 경우에 아래처럼 쿼리가 나갑니다.
where
insight0_.
writer_id
=?and insight0_.
insight_id
<?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.
아.. 그냥 뭉탱이로 Null이면 상관없나요
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.
네 querydsl의 where에서 파라미터가 null인 경우에는 제외한다고 하네요