-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
45 additions
and
10 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,6 @@ | |
|
||
public enum RoomType { | ||
|
||
MORNING, NIGHT | ||
MORNING, | ||
NIGHT | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/com/moabam/api/domain/repository/ParticipantSearchRepository.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,30 @@ | ||
package com.moabam.api.domain.repository; | ||
|
||
import static com.moabam.api.domain.entity.QParticipant.*; | ||
|
||
import java.util.Optional; | ||
|
||
import org.springframework.stereotype.Repository; | ||
|
||
import com.moabam.api.domain.entity.Participant; | ||
import com.moabam.global.common.util.DynamicQuery; | ||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@Repository | ||
@RequiredArgsConstructor | ||
public class ParticipantSearchRepository { | ||
|
||
private final JPAQueryFactory jpaQueryFactory; | ||
|
||
public Optional<Participant> findParticipant(Long roomId, Long memberId) { | ||
return Optional.ofNullable( | ||
jpaQueryFactory.selectFrom(participant) | ||
.where( | ||
DynamicQuery.generateEq(roomId, participant.room.id::eq), | ||
DynamicQuery.generateEq(memberId, participant.memberId::eq) | ||
).fetchOne() | ||
); | ||
} | ||
} |