-
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 #10 from GDSC-Hongik/feature/deploy
Feature/deploy
- Loading branch information
Showing
11 changed files
with
181 additions
and
11 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
58 changes: 58 additions & 0 deletions
58
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,58 @@ | ||
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); | ||
|
||
/** | ||
* 특정 멤버의 특정 스터디에 대한 상태 조회 | ||
* | ||
* @param memberId 멤버 아이디 | ||
* @param studyId 스터디 아이디 | ||
* @return 스터디 지원 상태, 지원한 이력이 없다면 {@code Optional.empty()} | ||
*/ | ||
@Query( | ||
"SELECT sm FROM StudyMember sm WHERE" | ||
+ " sm.member.id = :memberId AND" | ||
+ " sm.study.id = :studyId") | ||
Optional<StudyMemberStatus> findStudyMemberStatus( | ||
@Param("memberId") Long memberId, @Param("studyId") Long studyId); | ||
|
||
Member findByGithub(String github); | ||
} |
27 changes: 27 additions & 0 deletions
27
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,27 @@ | ||
package com.gdgoc.study_group.round.dao; | ||
|
||
import com.gdgoc.study_group.comment.domain.Comment; | ||
import com.gdgoc.study_group.round.domain.Round; | ||
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 RoundRepository extends JpaRepository<Round, Long> { | ||
// ================ COMMENT ================ // | ||
/** | ||
* 회차의 모든 댓글 조회 | ||
* | ||
* @param roundId 라운드 아이디 | ||
* @return 해당 라운드의 모든 댓글 리스트 | ||
*/ | ||
@Query("SELECT c FROM Comment c WHERE c.round.id = :roundId") | ||
List<Comment> findComments(@Param("roundId") Long roundId); | ||
|
||
@Query("SELECT c FROM Comment c WHERE c.round.id = :roundId AND" + " c.member.id = :memberId") | ||
Optional<Comment> findCommentByMemberId( | ||
@Param("roundId") Long roundId, @Param("memberId") Long memberId); | ||
} |
72 changes: 72 additions & 0 deletions
72
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,72 @@ | ||
package com.gdgoc.study_group.study.dao; | ||
|
||
import com.gdgoc.study_group.answer.domain.Answer; | ||
import com.gdgoc.study_group.curriculum.domain.Curriculum; | ||
import com.gdgoc.study_group.day.domain.Day; | ||
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.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface StudyRepository extends JpaRepository<Study, Long> { | ||
// ================ STUDY ================ // | ||
/** | ||
* 해당하는 스터디 상태를 가진 모든 스터디를 조회합니다 | ||
* | ||
* @param studyStatus 조회를 원하는 스터디의 상태 | ||
* @return 해당 상태를 가진 스터디 List | ||
*/ | ||
List<Study> findByStudyStatus(StudyStatus studyStatus); | ||
|
||
/** | ||
* 모집 중인 스터디 목록 조회 | ||
* | ||
* @return 모집 중인 스터디 List | ||
*/ | ||
@Query("SELECT s FROM Study s WHERE s.isApplicationClosed = false") | ||
List<Study> findRecruitingStudy(); | ||
|
||
// ================ CURRICULUM ================ // | ||
/** | ||
* 스터디의 모든 커리큘럼을 조회합니다 | ||
* | ||
* @param studyId 스터디 아이디 | ||
* @return 커리큘럼 List | ||
*/ | ||
@Query(value = "SELECT c FROM Curriculum c WHERE c.study.id = :studyId") | ||
List<Curriculum> findCurriculums(@Param("studyId") Long studyId); | ||
|
||
/** | ||
* 스터디의 특정 회차의 Curriculum 을 조회합니다 | ||
* | ||
* @param studyId 스터디 아이디 | ||
* @param week 조회할 회차 | ||
* @return 해당 회차의 Curriculum | ||
*/ | ||
@Query("SELECT c FROM Curriculum c WHERE" + " c.study.id = :studyId AND" + " c.week = :week") | ||
Curriculum findCurriculumByWeek(@Param("studyId") Long studyId, @Param("week") Integer week); | ||
|
||
// ================ DAY ================ // | ||
/** | ||
* 해당 스터디의 날짜 정보를 조회합니다 | ||
* | ||
* @param studyId 조회할 스터디의 Id | ||
* @return 해당 스터디의 주간 일정을 {@code List<Day> } 형식으로 반환 | ||
*/ | ||
@Query(value = "SELECT d FROM Day d WHERE d.study.id = :studyId") | ||
List<Day> getStudyDay(@Param("studyId") Long studyId); | ||
|
||
// ================ ANSWER ================ // | ||
/** | ||
* 해당 스터디의 모든 답변을 조회합니다 | ||
* | ||
* @param studyId 검색할 스터디의 id | ||
* @return 해당 스터디의 답변들을 반환 | ||
*/ | ||
@Query("SELECT a FROM Answer a WHERE a.study.id = :studyId") | ||
List<Answer> findAnswers(@Param("studyId") Long studyId); | ||
} |
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
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
server: | ||
port: ${SERVER_PORT} | ||
address: ${SERVER_ADDRESS} | ||
|
||
spring: | ||
datasource: | ||
|