-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from GDSC-Hongik/feature/repository-member-stud…
…y-round member, study, round repository 설정
- Loading branch information
Showing
15 changed files
with
136 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
15 changes: 15 additions & 0 deletions
15
src/main/java/com/gdgoc/study_group/answer/dao/AnswerRepository.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,15 @@ | ||
package com.gdgoc.study_group.answer.dao; | ||
|
||
import com.gdgoc.study_group.answer.domain.Answer; | ||
import java.util.List; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface AnswerRepository extends JpaRepository<Answer, Long> { | ||
|
||
boolean existsByMemberIdAndStudyId(Long memberId, Long studyId); | ||
|
||
// 스터디 신청 답변 조회 | ||
List<Answer> findByStudyId(Long studyId); | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/com/gdgoc/study_group/comment/dao/CommentRepository.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,8 @@ | ||
package com.gdgoc.study_group.comment.dao; | ||
|
||
import com.gdgoc.study_group.comment.domain.Comment; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface CommentRepository extends JpaRepository<Comment, Long> {} |
8 changes: 8 additions & 0 deletions
8
src/main/java/com/gdgoc/study_group/curriculum/dao/CurriculumRepository.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,8 @@ | ||
package com.gdgoc.study_group.curriculum.dao; | ||
|
||
import com.gdgoc.study_group.curriculum.domain.Curriculum; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface CurriculumRepository extends CrudRepository<Curriculum, Long> {} |
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
8 changes: 8 additions & 0 deletions
8
src/main/java/com/gdgoc/study_group/day/dao/DayRepository.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,8 @@ | ||
package com.gdgoc.study_group.day.dao; | ||
|
||
import com.gdgoc.study_group.day.domain.Day; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface DayRepository extends CrudRepository<Day, Long> {} |
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
43 changes: 43 additions & 0 deletions
43
src/main/java/com/gdgoc/study_group/member/dao/MemberRepository.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,43 @@ | ||
package com.gdgoc.study_group.member.dao; | ||
|
||
import com.gdgoc.study_group.member.domain.Member; | ||
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; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface MemberRepository extends JpaRepository<Member, Long> { | ||
/** | ||
* 해당 멤버가 해당 상태를 가진 스터디 목록들을 반환합니다. | ||
* | ||
* @param memberId 검색할 대상이 되는 멤버의 PK | ||
* @param memberStatus 검색할 대상이 되는 멤버가 스터디에서 가지길 기대하는 상태 | ||
* @return 해당 멤버가 포함되고, 해당 상태를 상태로 가지는 스터디들을 반환합니다. | ||
*/ | ||
@Query( | ||
"SELECT sm.study FROM StudyMember sm WHERE" | ||
+ " sm.member.id = :id AND" | ||
+ " sm.studyMemberStatus = :memberStatus") | ||
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); | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/com/gdgoc/study_group/round/dao/RoundRepository.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,8 @@ | ||
package com.gdgoc.study_group.round.dao; | ||
|
||
import com.gdgoc.study_group.round.domain.Round; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface RoundRepository extends JpaRepository<Round, Long> {} |
8 changes: 8 additions & 0 deletions
8
src/main/java/com/gdgoc/study_group/roundMember/dao/RoundMemberRepository.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,8 @@ | ||
package com.gdgoc.study_group.roundMember.dao; | ||
|
||
import com.gdgoc.study_group.roundMember.domain.RoundMember; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface RoundMemberRepository extends JpaRepository<RoundMember, Long> {} |
17 changes: 17 additions & 0 deletions
17
src/main/java/com/gdgoc/study_group/study/dao/StudyRepository.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,17 @@ | ||
package com.gdgoc.study_group.study.dao; | ||
|
||
import com.gdgoc.study_group.study.domain.Study; | ||
import com.gdgoc.study_group.study.domain.StudyStatus; | ||
import java.util.List; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface StudyRepository extends JpaRepository<Study, Long> { | ||
|
||
// 특정 Status인 스터디 목록 조회 | ||
List<Study> findByStatus(StudyStatus studyStatus); | ||
|
||
// 모집 중인 스터디 목록 조회(status != FINISHED) | ||
List<Study> findByStatusNot(StudyStatus studyStatus); | ||
} |
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
7 changes: 7 additions & 0 deletions
7
src/main/java/com/gdgoc/study_group/study/domain/StudyStatus.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,7 @@ | ||
package com.gdgoc.study_group.study.domain; | ||
|
||
public enum StudyStatus { | ||
OFFLINE, | ||
ONLINE, | ||
FINISHED | ||
} |
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
2 changes: 1 addition & 1 deletion
2
...tudy_group/studyMember/domain/Status.java → ...studyMember/domain/StudyMemberStatus.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