-
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
Changes from 2 commits
bec0e49
08e851f
c8474d2
aed6fae
c98d24d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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. 넣었습니당다아당 |
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 | ||
); | ||
|
||
} |
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; | ||
} | ||
|
||
|
||
} |
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. Swagger 작성 된건지 확인해주시면 감사하겠슴둥 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. 작성햇어욥!! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package io.oeid.mogakgo.domain.matching.presentation.dto; | ||
|
||
import io.oeid.mogakgo.domain.matching.domain.entity.enums.MatchingStatus; | ||
import java.time.LocalDateTime; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public class MatchingHistoryRes { | ||
|
||
private final Long matchingId; | ||
private final MatchingStatus status; | ||
private final String anotherUserAvatarUrl; | ||
private final String projectLocationDetail; | ||
private final LocalDateTime projectStartTime; | ||
private final LocalDateTime projectEndTime; | ||
|
||
} |
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.
👍🏻