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

Feature/deploy #10

Merged
merged 42 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
df9b0e1
chore: swagger 의존성 추가
ybkang1108 Jan 9, 2025
eaf1188
feat: 각 도메인마다 레포지토리 추가
ybkang1108 Jan 10, 2025
cb189f3
fix: 디렉토리 구조 변경
ybkang1108 Jan 10, 2025
eb8f7ac
feat: 스터디 생성 기능 추가
ybkang1108 Jan 11, 2025
63500ab
feat: 스터디 목록 조회 기능 추가
ybkang1108 Jan 11, 2025
be0271f
구조 수정 및 레포지토리 추가
ybkang1108 Jan 13, 2025
71ed756
package path 정리
cmj7271 Jan 14, 2025
0fc16bc
dao, domain 외 테스트용 파일 제거
cmj7271 Jan 14, 2025
f34ceab
study, studyMember domain 의 status enum 이름 변경
cmj7271 Jan 14, 2025
12518ac
MemberRepository 에 custom query 추가
cmj7271 Jan 14, 2025
ecf32e5
feat: Add Answer Repository
ybkang1108 Jan 14, 2025
be2464b
특정 멤버, 특정 상태를 가진 스터디 목록 쿼리 수정
cmj7271 Jan 14, 2025
7d7b100
feat: Add Curriculum Repository
ybkang1108 Jan 14, 2025
d4a8a2f
enum class 명을 바꾸면서 생긴 query by method 수정
cmj7271 Jan 14, 2025
288831c
feat: Add Comment Repository
ybkang1108 Jan 14, 2025
d3afa4c
feat: Add Day Repository
ybkang1108 Jan 14, 2025
122086c
다대다 관계에서의 중간 테이블인 StudyMemberRepository 제거
cmj7271 Jan 14, 2025
f1aa664
feat: Add Answer Repository
ybkang1108 Jan 14, 2025
1854046
refactor: 메서드 이름 변경
ybkang1108 Jan 14, 2025
d860e90
MemberRepository 에 MemberStatus 를 찾는 쿼리 추가
cmj7271 Jan 14, 2025
d4d9325
study annotation 정리
cmj7271 Jan 14, 2025
9ff1a33
Study domain 에 지원 기간 종료 여부 필드 추가
cmj7271 Jan 14, 2025
b33ecb6
Merge branch 'develop' into feature/repository-member-study-round
cmj7271 Jan 14, 2025
b2bf9f8
Merge pull request #8 from GDSC-Hongik/feature/repository-member-stud…
cmj7271 Jan 14, 2025
f057aca
Merge branch 'develop' into feature/repository
ybkang1108 Jan 14, 2025
1cee195
feat: Add Answer Repository
ybkang1108 Jan 14, 2025
bea5d48
feat: Add Curriculum Repository
ybkang1108 Jan 14, 2025
10715a2
feat: Add Comment Repository
ybkang1108 Jan 14, 2025
6b29bf1
feat: Add Day Repository
ybkang1108 Jan 14, 2025
affc255
feat: Add Answer Repository
ybkang1108 Jan 14, 2025
c195aa0
refactor: 메서드 이름 변경
ybkang1108 Jan 14, 2025
8df7eb7
answer repository 제거
cmj7271 Jan 15, 2025
7ce96ff
comment repository 제거
cmj7271 Jan 15, 2025
424d534
curriculum repository 제거
cmj7271 Jan 15, 2025
507a541
roundMember repository 제거
cmj7271 Jan 15, 2025
e847fa4
round repository 의 쿼리를 study 로 이동
cmj7271 Jan 15, 2025
b3f381b
day repository 의 쿼리를 study 로 이동
cmj7271 Jan 15, 2025
648547b
round repository 에 comment 관련 쿼리 추가
cmj7271 Jan 15, 2025
8b99f60
Merge branch 'feature/repository' of https://github.com/GDSC-Hongik/g…
cmj7271 Jan 15, 2025
de6f39a
refactor: 키워드 대문자 변경
ybkang1108 Jan 15, 2025
f6d262a
Merge pull request #9 from GDSC-Hongik/feature/repository
cmj7271 Jan 15, 2025
9709f31
gcp cloud run 을 위한 세팅
cmj7271 Jan 15, 2025
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
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ repositories {
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.5.0'
implementation 'org.postgresql:postgresql'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
Expand All @@ -38,6 +39,9 @@ dependencies {
tasks.named('test') {
useJUnitPlatform()
}
tasks.named("jar") {
enabled = false
}

spotless {
java {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import lombok.Getter;
import lombok.Setter;

@Entity
@Getter
@Setter
public class Curriculum {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/gdgoc/study_group/day/domain/Day.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import java.time.LocalTime;
import lombok.Getter;
import lombok.Setter;

@Entity
@Getter
@Setter
public class Day {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand Down
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 src/main/java/com/gdgoc/study_group/round/dao/RoundRepository.java
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 src/main/java/com/gdgoc/study_group/study/dao/StudyRepository.java
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);
}
11 changes: 3 additions & 8 deletions src/main/java/com/gdgoc/study_group/study/domain/Study.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@
import com.gdgoc.study_group.day.domain.Day;
import com.gdgoc.study_group.round.domain.Round;
import com.gdgoc.study_group.studyMember.domain.StudyMember;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import jakarta.persistence.*;
import java.util.ArrayList;
import java.util.List;

Expand All @@ -37,11 +31,12 @@ public class Study {
private List<Answer> answers = new ArrayList<>();

@Enumerated(EnumType.STRING)
private Status status;
private StudyStatus studyStatus;

private String name;
private String description;
private String requirement; // 지원 자격, nullable: 별도 요구 자격 없음
private String question; // 지원 질문, nullable: 지원 답변 없이 바로 신청 가능
private Integer maxParticipants; // null == 인원 제한 X
private Boolean isApplicationClosed = false; // 멤버 지원 종료 여부(기본값은 지원 가능)
}
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
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ public class StudyMember {
private Study study;

@Enumerated(EnumType.STRING)
private Status status;
private StudyMemberStatus studyMemberStatus;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.gdgoc.study_group.studyMember.domain;

public enum Status {
public enum StudyMemberStatus {
LEADER,
PARTICIPANT,
WAITING,
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
server:
port: ${SERVER_PORT}
address: ${SERVER_ADDRESS}

spring:
datasource:
Expand Down
Loading