-
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/#135 내 매칭 기록 조회하기 #176
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bec0e49
[FEAT] 내 매칭 기록 조회하기 기능 구현
happyjamy 08e851f
[FIX] 프로젝트 요청 정렬 누락 오류 해결
happyjamy c8474d2
[FIX] Repository 어노테이션 누락 해결
happyjamy aed6fae
[FIX] swagger 설명 추가
happyjamy c98d24d
Merge branch 'develop' into feat/#135-my_matching
happyjamy 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
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
14 changes: 14 additions & 0 deletions
14
src/main/java/io/oeid/mogakgo/domain/matching/infrastructure/MatchingRepositoryCustom.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,14 @@ | ||
package io.oeid.mogakgo.domain.matching.infrastructure; | ||
|
||
import io.oeid.mogakgo.common.base.CursorPaginationInfoReq; | ||
import io.oeid.mogakgo.common.base.CursorPaginationResult; | ||
import io.oeid.mogakgo.domain.matching.presentation.dto.MatchingHistoryRes; | ||
import java.util.List; | ||
|
||
public interface MatchingRepositoryCustom { | ||
|
||
CursorPaginationResult<MatchingHistoryRes> getMyMatches( | ||
Long userId, CursorPaginationInfoReq cursorPaginationInfoReq | ||
); | ||
|
||
} |
64 changes: 64 additions & 0 deletions
64
...ain/java/io/oeid/mogakgo/domain/matching/infrastructure/MatchingRepositoryCustomImpl.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,64 @@ | ||
package io.oeid.mogakgo.domain.matching.infrastructure; | ||
|
||
import static io.oeid.mogakgo.domain.matching.domain.entity.QMatching.matching; | ||
import static io.oeid.mogakgo.domain.project.domain.entity.QProject.project; | ||
|
||
import com.querydsl.core.types.Projections; | ||
import com.querydsl.core.types.dsl.BooleanExpression; | ||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import io.oeid.mogakgo.common.base.CursorPaginationInfoReq; | ||
import io.oeid.mogakgo.common.base.CursorPaginationResult; | ||
import io.oeid.mogakgo.domain.matching.presentation.dto.MatchingHistoryRes; | ||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
@RequiredArgsConstructor | ||
public class MatchingRepositoryCustomImpl implements MatchingRepositoryCustom { | ||
|
||
private final JPAQueryFactory jpaQueryFactory; | ||
|
||
|
||
@Override | ||
public CursorPaginationResult<MatchingHistoryRes> getMyMatches( | ||
Long userId, CursorPaginationInfoReq cursorPaginationInfoReq | ||
) { | ||
List<MatchingHistoryRes> matchingHistoryResList = jpaQueryFactory | ||
.select( | ||
Projections.constructor( | ||
MatchingHistoryRes.class, | ||
matching.id, | ||
matching.matchingStatus, | ||
matching.project.creator.avatarUrl, | ||
matching.project.meetingInfo.meetDetail, | ||
matching.project.meetingInfo.meetStartTime, | ||
matching.project.meetingInfo.meetEndTime | ||
) | ||
) | ||
.from(matching) | ||
.join(matching.project) | ||
.where( | ||
participantInMatching(userId), | ||
cursorIdCondition(cursorPaginationInfoReq.getCursorId()) | ||
) | ||
// 최근순 | ||
.orderBy(matching.id.desc()) | ||
.limit(cursorPaginationInfoReq.getPageSize() + 1) | ||
.fetch(); | ||
|
||
return CursorPaginationResult.fromDataWithExtraItemForNextCheck(matchingHistoryResList, | ||
cursorPaginationInfoReq.getPageSize()); | ||
} | ||
|
||
private BooleanExpression cursorIdCondition(Long cursorId) { | ||
return cursorId != null ? matching.id.lt(cursorId) : null; | ||
} | ||
|
||
private BooleanExpression participantInMatching(Long userId) { | ||
return userId != null ? (matching.sender.id.eq(userId).or(matching.project.creator.id.eq( | ||
userId))) : 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
27 changes: 27 additions & 0 deletions
27
src/main/java/io/oeid/mogakgo/domain/matching/presentation/dto/MatchingHistoryRes.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,27 @@ | ||
package io.oeid.mogakgo.domain.matching.presentation.dto; | ||
|
||
import io.oeid.mogakgo.domain.matching.domain.entity.enums.MatchingStatus; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.time.LocalDateTime; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Schema(description = "매칭 이력") | ||
@Getter | ||
@AllArgsConstructor | ||
public class MatchingHistoryRes { | ||
|
||
@Schema(description = "매칭 ID") | ||
private final Long matchingId; | ||
@Schema(description = "매칭 상태") | ||
private final MatchingStatus status; | ||
@Schema(description = "상대방 프로필 이미지 URL") | ||
private final String anotherUserAvatarUrl; | ||
@Schema(description = "프로젝트 위치 상세") | ||
private final String projectLocationDetail; | ||
@Schema(description = "프로젝트 시작 시간") | ||
private final LocalDateTime projectStartTime; | ||
@Schema(description = "프로젝트 종료 시간") | ||
private final LocalDateTime projectEndTime; | ||
|
||
} |
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
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.
👍🏻