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

member, study, round repository 설정 #8

Merged
merged 17 commits into from
Jan 14, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
MemberRepository 에 MemberStatus 를 찾는 쿼리 추가
cmj7271 committed Jan 14, 2025
commit d860e90f4a875b97020237462a15a37c44ab9d2c
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
import com.gdgoc.study_group.study.domain.Study;
import com.gdgoc.study_group.studyMember.domain.StudyMemberStatus;
import java.util.List;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
@@ -25,5 +26,18 @@ public interface MemberRepository extends JpaRepository<Member, Long> {
List<Study> findByMemberIdAndStatus(
@Param("id") Long memberId, @Param("memberStatus") StudyMemberStatus memberStatus);

/**
* 해당 멤버의 스터디에서의 상태를 조회합니다.
*
* @param memberId 검색할 멤버의 id
* @param studyId 검색할 스터디의 id
* @return 해당 스터디에서 멤버의 상태(Optional)
*/
@Query(
"SELECT sm.studyMemberStatus FROM StudyMember sm WHERE sm.member.id = :memberId AND"
+ " sm.study.id = :studyId")
Optional<StudyMemberStatus> findMemberStatus(
@Param("memberId") Long memberId, @Param("studyId") Long studyId);

Member findByGithub(String github);
}