-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: 스터디 기본 정보와 상세 정보 작성 API #642
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
fc8157d
feat: 스터디 상세 작성 스펙 구현
AlmondBreez3 07c10f7
feat: 스터디 상세 정보 기본 로직 작성
AlmondBreez3 05422cc
feat: 스터디 상세 정보 작성 API
AlmondBreez3 0bbf3f1
feat: validate 개선
AlmondBreez3 dfcd0d1
feat: 테스트 케이스 추가
AlmondBreez3 616f2f5
fix: merge conflict 해결
AlmondBreez3 b10f888
feat: 전체 로직 구현
AlmondBreez3 15452f7
feat: 전체 로직, validaotr 테스트코드 작성
AlmondBreez3 16c9aac
feat: log 추가
AlmondBreez3 22d0afc
feat: test 가독성 개선
AlmondBreez3 846ffa5
fix: merge conflict 해결하기
AlmondBreez3 6593f4e
feat: 에러 코드 수정
AlmondBreez3 a6fb8db
feat: 수정 로직 불필요한 주석 제거
AlmondBreez3 5badce8
feat: 스터디 상세 정보 id 제약조건 추가
AlmondBreez3 a444b60
feat: 스터디 상세 정보 비즈니스 로직에서 스터디 비즈니스 로직으로 변경
AlmondBreez3 868f05e
feat: 스터디 요청 Dto 이름 변경
AlmondBreez3 37d650b
feat: 스터디 상세 정보 -> 스터디 상세 & 기본으로 변경
AlmondBreez3 fc65781
fix: develop과 머지 컨플릭트 해결
AlmondBreez3 d944516
fix: pr 수정 요청 부분 수정
AlmondBreez3 d878603
feat: 고정된 날짜 사용으로 대체하기
AlmondBreez3 cffe5bb
feat: this로 객체 메서드 오류 해결, 테스트 불필요한 fixture삭제
AlmondBreez3 55eea81
feat: 올바른 테스트 데이터 작성
AlmondBreez3 f20ef1a
feat: 스터디 시작 시간을 세션 시작시간으로 변경
AlmondBreez3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
13 changes: 13 additions & 0 deletions
13
src/main/java/com/gdschongik/gdsc/domain/study/dto/request/StudySessionCreateRequest.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,13 @@ | ||
package com.gdschongik.gdsc.domain.study.dto.request; | ||
|
||
import com.gdschongik.gdsc.domain.study.domain.Difficulty; | ||
import com.gdschongik.gdsc.domain.study.domain.StudyStatus; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotNull; | ||
|
||
public record StudySessionCreateRequest( | ||
@NotNull Long studyDetailId, | ||
@Schema(description = "제목") String title, | ||
@Schema(description = "설명") String description, | ||
@Schema(description = "난이도") Difficulty difficulty, | ||
@Schema(description = "휴강 여부") StudyStatus status) {} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/gdschongik/gdsc/domain/study/dto/request/StudyUpdateRequest.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,9 @@ | ||
package com.gdschongik.gdsc.domain.study.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.util.List; | ||
|
||
public record StudyUpdateRequest( | ||
@Schema(description = "스터디 소개 페이지 링크") String notionLink, | ||
@Schema(description = "스터디 한 줄 소개") String introduction, | ||
List<StudySessionCreateRequest> studySessions) {} |
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
76 changes: 76 additions & 0 deletions
76
src/test/java/com/gdschongik/gdsc/domain/study/application/MentorStudyServiceTest.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,76 @@ | ||
package com.gdschongik.gdsc.domain.study.application; | ||
|
||
import static com.gdschongik.gdsc.global.common.constant.StudyConstant.*; | ||
import static com.gdschongik.gdsc.global.common.constant.StudyConstant.SESSION_DESCRIPTION; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import com.gdschongik.gdsc.domain.member.domain.Member; | ||
import com.gdschongik.gdsc.domain.member.domain.MemberRole; | ||
import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; | ||
import com.gdschongik.gdsc.domain.study.domain.Difficulty; | ||
import com.gdschongik.gdsc.domain.study.domain.Study; | ||
import com.gdschongik.gdsc.domain.study.domain.StudyDetail; | ||
import com.gdschongik.gdsc.domain.study.domain.StudyStatus; | ||
import com.gdschongik.gdsc.domain.study.dto.request.StudySessionCreateRequest; | ||
import com.gdschongik.gdsc.domain.study.dto.request.StudyUpdateRequest; | ||
import com.gdschongik.gdsc.helper.IntegrationTest; | ||
import java.time.LocalDateTime; | ||
import java.util.*; | ||
import org.junit.jupiter.api.*; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
public class MentorStudyServiceTest extends IntegrationTest { | ||
|
||
@Autowired | ||
private MentorStudyService mentorStudyService; | ||
|
||
@Nested | ||
class 스터디_정보_작성시 { | ||
|
||
@Test | ||
void 성공한다() { | ||
// given | ||
LocalDateTime now = STUDY_START_DATETIME; | ||
Member mentor = createMentor(); | ||
Study study = createNewStudy( | ||
mentor, | ||
4L, | ||
Period.createPeriod(now.plusDays(5), now.plusDays(10)), | ||
Period.createPeriod(now.minusDays(5), now)); | ||
for (int i = 1; i <= 4; i++) { | ||
Long week = (long) i; | ||
createNewStudyDetail(week, study, now, now.plusDays(7)); | ||
now = now.plusDays(8); | ||
} | ||
logoutAndReloginAs(study.getMentor().getId(), MemberRole.ASSOCIATE); | ||
|
||
List<StudySessionCreateRequest> sessionCreateRequests = new ArrayList<>(); | ||
for (int i = 1; i <= study.getTotalWeek(); i++) { | ||
Long id = (long) i; | ||
StudySessionCreateRequest sessionCreateRequest = new StudySessionCreateRequest( | ||
id, SESSION_TITLE + i, SESSION_DESCRIPTION + i, Difficulty.HIGH, StudyStatus.OPEN); | ||
sessionCreateRequests.add(sessionCreateRequest); | ||
} | ||
|
||
StudyUpdateRequest request = | ||
new StudyUpdateRequest(STUDY_NOTION_LINK, STUDY_INTRODUCTION, sessionCreateRequests); | ||
|
||
// when | ||
mentorStudyService.updateStudy(1L, request); | ||
|
||
// then | ||
Study savedStudy = studyRepository.findById(study.getId()).get(); | ||
assertThat(savedStudy.getNotionLink()).isEqualTo(request.notionLink()); | ||
|
||
List<StudyDetail> studyDetails = studyDetailRepository.findAllByStudyId(1L); | ||
for (int i = 0; i < studyDetails.size(); i++) { | ||
StudyDetail studyDetail = studyDetails.get(i); | ||
Long expectedId = studyDetail.getId(); | ||
|
||
assertThat(studyDetail.getId()).isEqualTo(expectedId); | ||
assertThat(studyDetail.getSession().getTitle()).isEqualTo(SESSION_TITLE + expectedId); | ||
assertThat(studyDetail.getSession().getDescription()).isEqualTo(SESSION_DESCRIPTION + expectedId); | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
두 로직을 추출하여 적절히 분리하는게 좋을 것 같습니다.