Skip to content

Commit 14a6443

Browse files
Merge pull request #239 from prgrms-web-devcourse-final-project/refactor/EA3-191-study-extension-return-id
[EA3-191] refactor: 스터디 연장 반환값 변경
2 parents 76798b0 + 2185f35 commit 14a6443

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/main/java/grep/neogulcoder/domain/study/controller/StudyManagementController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ public ApiResponse<Void> delegateLeader(@PathVariable("studyId") Long studyId,
4949
}
5050

5151
@PostMapping("/extension")
52-
public ApiResponse<Void> extendStudy(@PathVariable("studyId") Long studyId,
52+
public ApiResponse<Long> extendStudy(@PathVariable("studyId") Long studyId,
5353
@RequestBody @Valid ExtendStudyRequest request,
5454
@AuthenticationPrincipal Principal userDetails) {
55-
studyManagementService.extendStudy(studyId, request, userDetails.getUserId());
56-
return ApiResponse.noContent();
55+
Long extendStudyId = studyManagementService.extendStudy(studyId, request, userDetails.getUserId());
56+
return ApiResponse.success(extendStudyId);
5757
}
5858

5959
@PostMapping("/extension/participations")

src/main/java/grep/neogulcoder/domain/study/controller/StudyManagementSpecification.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public interface StudyManagementSpecification {
2727
ApiResponse<Void> delegateLeader(Long studyId, DelegateLeaderRequest request, Principal userDetails);
2828

2929
@Operation(summary = "스터디 연장", description = "스터디장이 스터디를 연장합니다.")
30-
ApiResponse<Void> extendStudy(Long studyId, ExtendStudyRequest request, Principal userDetails);
30+
ApiResponse<Long> extendStudy(Long studyId, ExtendStudyRequest request, Principal userDetails);
3131

3232
@Operation(summary = "연장 스터디 참여", description = "스터디원이 연장된 스터디에 참여합니다.")
3333
ApiResponse<Void> registerExtensionParticipation(Long studyId, Principal userDetails);

src/main/java/grep/neogulcoder/domain/study/service/StudyManagementService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public void deleteUserFromStudies(Long userId) {
120120
}
121121

122122
@Transactional
123-
public void extendStudy(Long studyId, ExtendStudyRequest request, Long userId) {
123+
public Long extendStudy(Long studyId, ExtendStudyRequest request, Long userId) {
124124
Study originStudy = findValidStudy(studyId);
125125

126126
StudyMember leader = findValidStudyMember(studyId, userId);
@@ -141,6 +141,8 @@ public void extendStudy(Long studyId, ExtendStudyRequest request, Long userId) {
141141
studyMemberRepository.save(extendedLeader);
142142

143143
eventPublisher.publishEvent(new StudyExtendEvent(originStudy.getId()));
144+
145+
return extendedStudy.getId();
144146
}
145147

146148
@Transactional

0 commit comments

Comments
 (0)