Skip to content
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

Merged
merged 5 commits into from
Dec 4, 2022
Merged

[Feat] 마이페이지 인사이트 조회 #159

merged 5 commits into from
Dec 4, 2022

Conversation

heoboseong7
Copy link
Collaborator

  1. 마이 페이지 인사이트 조회

    • userId로 cursor paging을 통한 인사이트 조회
    • 추가로 drawerId로 폴더 별 인사이트 조회
    • 문서화용 테스트
  2. batch_deploy 스크립트 수정

Comment on lines 1 to 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 ! !"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JAR_DIR /로 끝나면 잘되나요?ㅎㅋ

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

되기는 하는데 다른 데서도 안붙여서 떼는게 좋아 보여요

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

보니까 젠킨스에서 파라미터 주입하게돼있던데 파라미터 혹시 잘못넣으면 걱정돼서요 ㅎ

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아하 거기까진 생각 못했네요

Comment on lines +111 to +128

public List<Insight> findByUserIdAndDrawerId(Long userId, Long drawerId, CursorPageable<Long> cPage) {
return queryFactory
.select(insight)
.from(insight)
.where(insight.writer.id.eq(userId)
.and(insight.id.lt(cPage.getCursor()))
.and(drawerIdEq(drawerId))
)
.orderBy(insight.id.desc())
.limit(cPage.getLimit())
.fetch();
}


private BooleanExpression drawerIdEq(Long drawerId) {
return drawerId != null ? insight.drawer.id.eq(drawerId) : null;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drawerId가 Null인 케이스는 서랍 탭 중에 전체인 경우죠?

그럼 조건이 equal null로 들어가면 전체 조회가 안되지 않을까여?

Copy link
Collaborator Author

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<?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아.. 그냥 뭉탱이로 Null이면 상관없나요

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네 확인했습니닷

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네 querydsl의 where에서 파라미터가 null인 경우에는 제외한다고 하네요

Comment on lines 179 to 181
@Transactional(readOnly = true)
public List<InsightMyPageDto> getByUserId(User user, Long targetUserId, Long drawerId, CursorPageable<Long> cPage) {
List<Insight> insights = insightQueryRepository.findByUserIdAndDrawerId(targetUserId, drawerId, cPage);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List를 가져오는것과 단일객체를 가져올때 네이밍 구분이 명확했음 좋겠어요

이름은 userId로만 가져오는 것처럼 단순해보이지만 실제 파라미터는 너무 많아서 그렇지 않은거같기도하구요.ㅎ

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

서랍이 추가되기도 하면서 이름이 알맞지 않아보이네요
getInsightsForMyPage로 바꾸겠습니다

Copy link
Collaborator

@Youhoseong Youhoseong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인 부탁드려요.

@kimyoungi99
Copy link
Collaborator

수고하셨습니당

Copy link
Collaborator

@Youhoseong Youhoseong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@heoboseong7 heoboseong7 merged commit f609af1 into main Dec 4, 2022
@Youhoseong Youhoseong deleted the issue-#157 branch April 22, 2023 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat] 마이페이지 인사이트 조회
3 participants