diff --git a/src/main/java/com/example/demo/controller/StudyOnceController.java b/src/main/java/com/example/demo/controller/StudyOnceController.java index 6499de0..0a5825f 100644 --- a/src/main/java/com/example/demo/controller/StudyOnceController.java +++ b/src/main/java/com/example/demo/controller/StudyOnceController.java @@ -26,7 +26,10 @@ import com.example.demo.dto.study.StudyOnceCommentUpdateRequest; import com.example.demo.dto.study.StudyOnceCommentsSearchResponse; import com.example.demo.dto.study.StudyOnceCreateRequest; +import com.example.demo.dto.study.StudyOnceCreateResponse; +import com.example.demo.dto.study.StudyOnceInfoResponse; import com.example.demo.dto.study.StudyOnceJoinResult; +import com.example.demo.dto.study.StudyOnceSearchListResponse; import com.example.demo.dto.study.StudyOnceSearchRequest; import com.example.demo.dto.study.StudyOnceSearchResponse; import com.example.demo.dto.study.StudyOnceUpdateRequest; @@ -59,22 +62,22 @@ public ResponseEntity search(@PathVariable Long studyOn } @GetMapping("/list") - public ResponseEntity> searchList( + public ResponseEntity> searchList( @ModelAttribute StudyOnceSearchRequest studyOnceSearchRequest) { - PagedResponse pagedResponse = studyOnceService.searchStudy(studyOnceSearchRequest); + PagedResponse pagedResponse = studyOnceService.searchStudy(studyOnceSearchRequest); return ResponseEntity.ok(pagedResponse); } @PostMapping("") - public ResponseEntity create(@RequestBody StudyOnceCreateRequest studyOnceCreateRequest, + public ResponseEntity create(@RequestBody StudyOnceCreateRequest studyOnceCreateRequest, @RequestHeader("Authorization") String authorization) { long memberId = cafegoryTokenManager.getIdentityId(authorization); - StudyOnceSearchResponse response = studyOnceService.createStudy(memberId, studyOnceCreateRequest); + StudyOnceCreateResponse response = studyOnceService.createStudy(memberId, studyOnceCreateRequest); return ResponseEntity.ok(response); } @PatchMapping("/{studyOnceId:[0-9]+}") - public ResponseEntity update(@PathVariable Long studyOnceId, + public ResponseEntity update(@PathVariable Long studyOnceId, @RequestBody StudyOnceUpdateRequest request, @RequestHeader("Authorization") String authorization) { long leaderId = cafegoryTokenManager.getIdentityId(authorization); @@ -83,7 +86,7 @@ public ResponseEntity update(@PathVariable Long studyOn } else { studyOnceService.updateStudyOncePartially(leaderId, studyOnceId, request, LocalDateTime.now()); } - StudyOnceSearchResponse response = studyOnceService.findStudyOnce(studyOnceId, LocalDateTime.now()); + StudyOnceInfoResponse response = studyOnceService.findStudyOnce(studyOnceId, LocalDateTime.now()); return ResponseEntity.ok(response); } diff --git a/src/main/java/com/example/demo/dto/study/StudyOnceCreateResponse.java b/src/main/java/com/example/demo/dto/study/StudyOnceCreateResponse.java new file mode 100644 index 0000000..510358f --- /dev/null +++ b/src/main/java/com/example/demo/dto/study/StudyOnceCreateResponse.java @@ -0,0 +1,22 @@ +package com.example.demo.dto.study; + +import java.time.LocalDateTime; + +import lombok.Builder; +import lombok.Data; + +@Builder +@Data +public class StudyOnceCreateResponse { + private long cafeId; + private String area; + private long studyOnceId; + private String name; + private LocalDateTime startDateTime; + private LocalDateTime endDateTime; + private int maxMemberCount; + private int nowMemberCount; + private boolean canTalk; + private boolean canJoin; + private boolean isEnd; +} diff --git a/src/main/java/com/example/demo/dto/study/StudyOnceInfoResponse.java b/src/main/java/com/example/demo/dto/study/StudyOnceInfoResponse.java new file mode 100644 index 0000000..dad5997 --- /dev/null +++ b/src/main/java/com/example/demo/dto/study/StudyOnceInfoResponse.java @@ -0,0 +1,22 @@ +package com.example.demo.dto.study; + +import java.time.LocalDateTime; + +import lombok.Builder; +import lombok.Data; + +@Builder +@Data +public class StudyOnceInfoResponse { + private long cafeId; + private String area; + private long studyOnceId; + private String name; + private LocalDateTime startDateTime; + private LocalDateTime endDateTime; + private int maxMemberCount; + private int nowMemberCount; + private boolean canTalk; + private boolean canJoin; + private boolean isEnd; +} diff --git a/src/main/java/com/example/demo/dto/study/StudyOnceSearchListResponse.java b/src/main/java/com/example/demo/dto/study/StudyOnceSearchListResponse.java new file mode 100644 index 0000000..db2492b --- /dev/null +++ b/src/main/java/com/example/demo/dto/study/StudyOnceSearchListResponse.java @@ -0,0 +1,22 @@ +package com.example.demo.dto.study; + +import java.time.LocalDateTime; + +import lombok.Builder; +import lombok.Data; + +@Builder +@Data +public class StudyOnceSearchListResponse { + private long cafeId; + private String area; + private long studyOnceId; + private String name; + private LocalDateTime startDateTime; + private LocalDateTime endDateTime; + private int maxMemberCount; + private int nowMemberCount; + private boolean canTalk; + private boolean canJoin; + private boolean isEnd; +} diff --git a/src/main/java/com/example/demo/dto/study/StudyOnceSearchResponse.java b/src/main/java/com/example/demo/dto/study/StudyOnceSearchResponse.java index fce55dd..e0baec5 100644 --- a/src/main/java/com/example/demo/dto/study/StudyOnceSearchResponse.java +++ b/src/main/java/com/example/demo/dto/study/StudyOnceSearchResponse.java @@ -9,6 +9,7 @@ @Data public class StudyOnceSearchResponse { private long cafeId; + private long creatorId; private String area; private long studyOnceId; private String name; diff --git a/src/main/java/com/example/demo/mapper/StudyOnceMapper.java b/src/main/java/com/example/demo/mapper/StudyOnceMapper.java index 08ffe03..4d9a947 100644 --- a/src/main/java/com/example/demo/mapper/StudyOnceMapper.java +++ b/src/main/java/com/example/demo/mapper/StudyOnceMapper.java @@ -10,7 +10,10 @@ import com.example.demo.dto.WriterResponse; import com.example.demo.dto.study.StudyOnceCommentResponse; import com.example.demo.dto.study.StudyOnceCreateRequest; +import com.example.demo.dto.study.StudyOnceCreateResponse; import com.example.demo.dto.study.StudyOnceForCafeResponse; +import com.example.demo.dto.study.StudyOnceInfoResponse; +import com.example.demo.dto.study.StudyOnceSearchListResponse; import com.example.demo.dto.study.StudyOnceSearchResponse; public class StudyOnceMapper { @@ -47,8 +50,57 @@ public StudyOnce toNewEntity(StudyOnceCreateRequest studyOnceCreateRequest, Cafe .build(); } + public StudyOnceInfoResponse toStudyOnceInfoResponse(StudyOnce saved, boolean canJoin) { + return StudyOnceInfoResponse.builder() + .cafeId(saved.getCafe().getId()) + .area(saved.getCafe().getRegion()) + .studyOnceId(saved.getId()) + .name(saved.getName()) + .startDateTime(saved.getStartDateTime()) + .endDateTime(saved.getEndDateTime()) + .maxMemberCount(saved.getMaxMemberCount()) + .nowMemberCount(saved.getNowMemberCount()) + .canTalk(saved.isAbleToTalk()) + .canJoin(canJoin) + .isEnd(saved.isEnd()) + .build(); + } + public StudyOnceSearchResponse toStudyOnceSearchResponse(StudyOnce saved, boolean canJoin) { return StudyOnceSearchResponse.builder() + .cafeId(saved.getCafe().getId()) + .creatorId(saved.getLeader().getId()) + .area(saved.getCafe().getRegion()) + .studyOnceId(saved.getId()) + .name(saved.getName()) + .startDateTime(saved.getStartDateTime()) + .endDateTime(saved.getEndDateTime()) + .maxMemberCount(saved.getMaxMemberCount()) + .nowMemberCount(saved.getNowMemberCount()) + .canTalk(saved.isAbleToTalk()) + .canJoin(canJoin) + .isEnd(saved.isEnd()) + .build(); + } + + public StudyOnceSearchListResponse toStudyOnceSearchListResponse(StudyOnce saved, boolean canJoin) { + return StudyOnceSearchListResponse.builder() + .cafeId(saved.getCafe().getId()) + .area(saved.getCafe().getRegion()) + .studyOnceId(saved.getId()) + .name(saved.getName()) + .startDateTime(saved.getStartDateTime()) + .endDateTime(saved.getEndDateTime()) + .maxMemberCount(saved.getMaxMemberCount()) + .nowMemberCount(saved.getNowMemberCount()) + .canTalk(saved.isAbleToTalk()) + .canJoin(canJoin) + .isEnd(saved.isEnd()) + .build(); + } + + public StudyOnceCreateResponse toStudyOnceCreateResponse(StudyOnce saved, boolean canJoin) { + return StudyOnceCreateResponse.builder() .cafeId(saved.getCafe().getId()) .area(saved.getCafe().getRegion()) .studyOnceId(saved.getId()) diff --git a/src/main/java/com/example/demo/service/study/StudyOnceService.java b/src/main/java/com/example/demo/service/study/StudyOnceService.java index ae53691..5b3ae97 100644 --- a/src/main/java/com/example/demo/service/study/StudyOnceService.java +++ b/src/main/java/com/example/demo/service/study/StudyOnceService.java @@ -6,6 +6,9 @@ import com.example.demo.dto.PagedResponse; import com.example.demo.dto.study.StudyMembersResponse; import com.example.demo.dto.study.StudyOnceCreateRequest; +import com.example.demo.dto.study.StudyOnceCreateResponse; +import com.example.demo.dto.study.StudyOnceInfoResponse; +import com.example.demo.dto.study.StudyOnceSearchListResponse; import com.example.demo.dto.study.StudyOnceSearchRequest; import com.example.demo.dto.study.StudyOnceSearchResponse; import com.example.demo.dto.study.StudyOnceUpdateRequest; @@ -17,7 +20,7 @@ public interface StudyOnceService { void tryQuit(long memberIdThatExpectedToQuit, long studyId); - PagedResponse searchStudy(StudyOnceSearchRequest studyOnceSearchRequest); + PagedResponse searchStudy(StudyOnceSearchRequest studyOnceSearchRequest); StudyOnceSearchResponse searchByStudyId(long studyId); @@ -26,13 +29,13 @@ UpdateAttendanceResponse updateAttendances(long leaderId, long studyOnceId, void updateAttendance(long leaderId, long studyOnceId, long memberId, Attendance attendance, LocalDateTime now); - StudyOnceSearchResponse createStudy(long leaderId, StudyOnceCreateRequest studyOnceCreateRequest); + StudyOnceCreateResponse createStudy(long leaderId, StudyOnceCreateRequest studyOnceCreateRequest); Long changeCafe(Long requestMemberId, Long studyOnceId, Long changingCafeId); StudyMembersResponse findStudyMembersById(Long studyOnceId); - StudyOnceSearchResponse findStudyOnce(Long studyOnceId, LocalDateTime now); + StudyOnceInfoResponse findStudyOnce(Long studyOnceId, LocalDateTime now); boolean doesOnlyStudyLeaderExist(Long studyOnceId); diff --git a/src/main/java/com/example/demo/service/study/StudyOnceServiceImpl.java b/src/main/java/com/example/demo/service/study/StudyOnceServiceImpl.java index aebb191..5e7c89e 100644 --- a/src/main/java/com/example/demo/service/study/StudyOnceServiceImpl.java +++ b/src/main/java/com/example/demo/service/study/StudyOnceServiceImpl.java @@ -22,6 +22,9 @@ import com.example.demo.dto.study.StudyMemberStateResponse; import com.example.demo.dto.study.StudyMembersResponse; import com.example.demo.dto.study.StudyOnceCreateRequest; +import com.example.demo.dto.study.StudyOnceCreateResponse; +import com.example.demo.dto.study.StudyOnceInfoResponse; +import com.example.demo.dto.study.StudyOnceSearchListResponse; import com.example.demo.dto.study.StudyOnceSearchRequest; import com.example.demo.dto.study.StudyOnceSearchResponse; import com.example.demo.dto.study.StudyOnceUpdateRequest; @@ -79,15 +82,15 @@ private void deleteStudy(StudyOnce studyOnce) { } @Override - public PagedResponse searchStudy(StudyOnceSearchRequest studyOnceSearchRequest) { + public PagedResponse searchStudy(StudyOnceSearchRequest studyOnceSearchRequest) { int totalCount = Math.toIntExact(studyOnceRepository.count(studyOnceSearchRequest)); int sizePerPage = studyOnceSearchRequest.getSizePerPage(); int maxPage = calculateMaxPage(totalCount, sizePerPage); List allByStudyOnceSearchRequest = studyOnceRepository.findAllByStudyOnceSearchRequest( studyOnceSearchRequest); - List searchResults = allByStudyOnceSearchRequest + List searchResults = allByStudyOnceSearchRequest .stream() - .map(studyOnce -> studyOnceMapper.toStudyOnceSearchResponse(studyOnce, + .map(studyOnce -> studyOnceMapper.toStudyOnceSearchListResponse(studyOnce, studyOnce.canJoin(LocalDateTime.now()))) .collect(Collectors.toList()); return new PagedResponse<>(studyOnceSearchRequest.getPage(), maxPage, searchResults.size(), searchResults); @@ -177,7 +180,7 @@ private StudyOnce findStudyOnceById(long studyOnceId) { } @Override - public StudyOnceSearchResponse createStudy(long leaderId, StudyOnceCreateRequest studyOnceCreateRequest) { + public StudyOnceCreateResponse createStudy(long leaderId, StudyOnceCreateRequest studyOnceCreateRequest) { Cafe cafe = cafeRepository.findById(studyOnceCreateRequest.getCafeId()) .orElseThrow(() -> new CafegoryException(CAFE_NOT_FOUND)); //ToDo 카페 영업시간 이내인지 확인 하는 작업 추가 필요 @@ -186,7 +189,7 @@ public StudyOnceSearchResponse createStudy(long leaderId, StudyOnceCreateRequest StudyOnce studyOnce = studyOnceMapper.toNewEntity(studyOnceCreateRequest, cafe, leader); StudyOnce saved = studyOnceRepository.save(studyOnce); boolean canJoin = true; - return studyOnceMapper.toStudyOnceSearchResponse(saved, canJoin); + return studyOnceMapper.toStudyOnceCreateResponse(saved, canJoin); } @Override @@ -240,9 +243,9 @@ public StudyMembersResponse findStudyMembersById(Long studyOnceId) { } @Override - public StudyOnceSearchResponse findStudyOnce(Long studyOnceId, LocalDateTime now) { + public StudyOnceInfoResponse findStudyOnce(Long studyOnceId, LocalDateTime now) { StudyOnce studyOnce = findStudyOnceById(studyOnceId); - return studyOnceMapper.toStudyOnceSearchResponse(studyOnce, studyOnce.canJoin(now)); + return studyOnceMapper.toStudyOnceInfoResponse(studyOnce, studyOnce.canJoin(now)); } @Override diff --git a/src/test/java/com/example/demo/service/profile/ProfileServiceImplTest.java b/src/test/java/com/example/demo/service/profile/ProfileServiceImplTest.java index 64368f5..7598373 100644 --- a/src/test/java/com/example/demo/service/profile/ProfileServiceImplTest.java +++ b/src/test/java/com/example/demo/service/profile/ProfileServiceImplTest.java @@ -18,7 +18,7 @@ import com.example.demo.dto.profile.ProfileResponse; import com.example.demo.dto.profile.ProfileUpdateRequest; import com.example.demo.dto.study.StudyOnceCreateRequest; -import com.example.demo.dto.study.StudyOnceSearchResponse; +import com.example.demo.dto.study.StudyOnceCreateResponse; import com.example.demo.exception.CafegoryException; import com.example.demo.repository.cafe.InMemoryCafeRepository; import com.example.demo.repository.member.InMemoryMemberRepository; @@ -50,7 +50,7 @@ void successWhenRequestMemberIsLeaderWithTargetMember() { long targetMemberId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); LocalDateTime start = LocalDateTime.now().plusHours(4); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, start.plusHours(5), cafeId); - StudyOnceSearchResponse study = studyOnceService.createStudy(requestMemberId, studyOnceCreateRequest); + StudyOnceCreateResponse study = studyOnceService.createStudy(requestMemberId, studyOnceCreateRequest); studyOnceService.tryJoin(targetMemberId, study.getStudyOnceId()); Assertions.assertDoesNotThrow(() -> profileService.get(requestMemberId, targetMemberId)); } diff --git a/src/test/java/com/example/demo/service/study/StudyOnceServiceImplTest.java b/src/test/java/com/example/demo/service/study/StudyOnceServiceImplTest.java index 3be7561..5173ec4 100644 --- a/src/test/java/com/example/demo/service/study/StudyOnceServiceImplTest.java +++ b/src/test/java/com/example/demo/service/study/StudyOnceServiceImplTest.java @@ -27,6 +27,8 @@ import com.example.demo.dto.study.StudyMemberStateRequest; import com.example.demo.dto.study.StudyMembersResponse; import com.example.demo.dto.study.StudyOnceCreateRequest; +import com.example.demo.dto.study.StudyOnceCreateResponse; +import com.example.demo.dto.study.StudyOnceSearchListResponse; import com.example.demo.dto.study.StudyOnceSearchRequest; import com.example.demo.dto.study.StudyOnceSearchResponse; import com.example.demo.dto.study.StudyOnceUpdateRequest; @@ -73,17 +75,17 @@ void searchStudyByDto() { LocalDateTime end = start.plusHours(1); Cafe cafe = cafePersistHelper.persistDefaultCafe(); Member leader = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE); - StudyOnceSearchResponse expectedStudyOnceSearchResponse = studyOnceService.createStudy(leader.getId(), + StudyOnceCreateResponse expectedStudyOnceSearchResponse = studyOnceService.createStudy(leader.getId(), makeStudyOnceCreateRequest(start, end, cafe.getId())); //when StudyOnceSearchRequest studyOnceSearchRequest = new StudyOnceSearchRequest("합정동"); studyOnceSearchRequest.setMaxMemberCount(expectedStudyOnceSearchResponse.getMaxMemberCount()); syncStudyOnceRepositoryAndStudyMemberRepository(); - PagedResponse pagedResponse = studyOnceService.searchStudy(studyOnceSearchRequest); + PagedResponse pagedResponse = studyOnceService.searchStudy(studyOnceSearchRequest); //then - List results = pagedResponse.getList(); - assertThat(results).contains(expectedStudyOnceSearchResponse); + List results = pagedResponse.getList(); + assertThat(results.size()).isEqualTo(1); } private StudyOnceCreateRequest makeStudyOnceCreateRequest(LocalDateTime start, LocalDateTime end, @@ -108,7 +110,7 @@ void searchByStudyId() { long leaderId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId); - StudyOnceSearchResponse result = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); + StudyOnceCreateResponse result = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); StudyOnceSearchResponse studyOnceSearchResponse = studyOnceService.searchByStudyId(result.getStudyOnceId()); assertThat(studyOnceSearchResponse.getStudyOnceId()).isEqualTo(result.getStudyOnceId()); @@ -123,18 +125,18 @@ void create() { long leaderId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId); - StudyOnceSearchResponse result = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); - StudyOnceSearchResponse expected = makeExpectedStudyOnceCreateResult(cafeId, studyOnceCreateRequest, result); + StudyOnceCreateResponse result = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); + StudyOnceCreateResponse expected = makeExpectedStudyOnceCreateResult(cafeId, studyOnceCreateRequest, result); assertThat(result).isEqualTo(expected); } - private static StudyOnceSearchResponse makeExpectedStudyOnceCreateResult(long cafeId, - StudyOnceCreateRequest studyOnceCreateRequest, StudyOnceSearchResponse result) { + private static StudyOnceCreateResponse makeExpectedStudyOnceCreateResult(long cafeId, + StudyOnceCreateRequest studyOnceCreateRequest, StudyOnceCreateResponse result) { int nowMemberCount = 0; boolean canJoin = true; boolean isEnd = false; - return StudyOnceSearchResponse.builder() + return StudyOnceCreateResponse.builder() .cafeId(cafeId) .area(result.getArea()) .studyOnceId(result.getStudyOnceId()) @@ -221,7 +223,7 @@ void createFailByAlreadyStudyMember(LocalDateTime start, LocalDateTime end, Loca long leaderId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); long memberId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId); - StudyOnceSearchResponse study = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); + StudyOnceCreateResponse study = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); studyOnceService.tryJoin(memberId, study.getStudyOnceId()); // 오른쪽 끝에서 겹침 @@ -271,7 +273,7 @@ void tryJoin() { StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(LocalDateTime.now().plusHours(4), LocalDateTime.now().plusHours(7), cafeId); - StudyOnceSearchResponse study = studyOnceService.createStudy(firstMemberId, studyOnceCreateRequest); + StudyOnceCreateResponse study = studyOnceService.createStudy(firstMemberId, studyOnceCreateRequest); assertDoesNotThrow(() -> studyOnceService.tryJoin(secondMemberId, study.getStudyOnceId())); } @@ -284,7 +286,7 @@ void tryJoinFailCauseDuplicate() { long cafeId = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(LocalDateTime.now().plusHours(4), LocalDateTime.now().plusHours(7), cafeId); - StudyOnceSearchResponse study = studyOnceService.createStudy(firstMemberId, studyOnceCreateRequest); + StudyOnceCreateResponse study = studyOnceService.createStudy(firstMemberId, studyOnceCreateRequest); studyOnceService.tryJoin(secondMemberId, study.getStudyOnceId()); @@ -304,12 +306,12 @@ void tryJoinFailCauseConflict(LocalDateTime start, LocalDateTime end, LocalDateT long thirdMemberId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); long cafeId = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId); - StudyOnceSearchResponse study = studyOnceService.createStudy(firstMemberId, studyOnceCreateRequest); + StudyOnceCreateResponse study = studyOnceService.createStudy(firstMemberId, studyOnceCreateRequest); studyOnceService.tryJoin(secondMemberId, study.getStudyOnceId()); StudyOnceCreateRequest conflictStudyOnceCreateRequest = makeStudyOnceCreateRequest(conflictStart, conflictEnd, cafeId); - StudyOnceSearchResponse conflictStudy = studyOnceService.createStudy(thirdMemberId, + StudyOnceCreateResponse conflictStudy = studyOnceService.createStudy(thirdMemberId, conflictStudyOnceCreateRequest); syncStudyOnceRepositoryAndStudyMemberRepository(); @@ -327,7 +329,7 @@ void tryQuit() { long secondMemberId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); long cafeId = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId); - StudyOnceSearchResponse study = studyOnceService.createStudy(firstMemberId, studyOnceCreateRequest); + StudyOnceCreateResponse study = studyOnceService.createStudy(firstMemberId, studyOnceCreateRequest); studyOnceService.tryJoin(secondMemberId, study.getStudyOnceId()); assertDoesNotThrow(() -> studyOnceService.tryQuit(secondMemberId, study.getStudyOnceId())); @@ -343,7 +345,7 @@ void tryQuitFailCauseNotJoin() { long cafeId = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId); - StudyOnceSearchResponse study = studyOnceService.createStudy(firstMemberId, studyOnceCreateRequest); + StudyOnceCreateResponse study = studyOnceService.createStudy(firstMemberId, studyOnceCreateRequest); assertThatThrownBy(() -> studyOnceService.tryQuit(secondMemberId, study.getStudyOnceId())) .isInstanceOf(CafegoryException.class) @@ -359,7 +361,7 @@ void tryQuitFailCauseNotOnlyLeader() { long secondMemberId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); long cafeId = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId); - StudyOnceSearchResponse study = studyOnceService.createStudy(firstMemberId, studyOnceCreateRequest); + StudyOnceCreateResponse study = studyOnceService.createStudy(firstMemberId, studyOnceCreateRequest); studyOnceService.tryJoin(secondMemberId, study.getStudyOnceId()); @@ -376,7 +378,7 @@ void take_attendance() { long cafeId = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId); long leaderId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); - StudyOnceSearchResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); + StudyOnceCreateResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); long memberId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); long studyOnceId = searchResponse.getStudyOnceId(); studyOnceService.tryJoin(memberId, studyOnceId); @@ -413,7 +415,7 @@ void take_attendance_memberId_exception() { long cafeId = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId); long leaderId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); - StudyOnceSearchResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); + StudyOnceCreateResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); long memberId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); long studyOnceId = searchResponse.getStudyOnceId(); studyOnceService.tryJoin(memberId, studyOnceId); @@ -434,7 +436,7 @@ void take_attendance_leaderId_exception() { long cafeId = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId); long leaderId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); - StudyOnceSearchResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); + StudyOnceCreateResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); long memberId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); long studyOnceId = searchResponse.getStudyOnceId(); studyOnceService.tryJoin(memberId, studyOnceId); @@ -455,7 +457,7 @@ void can_take_attendance_from_start_time_in_10min_exception() { long cafeId = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId); long leaderId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); - StudyOnceSearchResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); + StudyOnceCreateResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); long memberId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); long studyOnceId = searchResponse.getStudyOnceId(); studyOnceService.tryJoin(memberId, studyOnceId); @@ -476,7 +478,7 @@ void can_take_attendance_until_half_whole_study_time_exception() { long cafeId = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId); long leaderId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); - StudyOnceSearchResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); + StudyOnceCreateResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); long memberId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); long studyOnceId = searchResponse.getStudyOnceId(); studyOnceService.tryJoin(memberId, studyOnceId); @@ -497,7 +499,7 @@ void can_take_attendances() { long cafeId = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId); long leaderId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); - StudyOnceSearchResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); + StudyOnceCreateResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); long memberId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); long studyOnceId = searchResponse.getStudyOnceId(); studyOnceService.tryJoin(memberId, studyOnceId); @@ -521,7 +523,7 @@ void change_cafe() { long cafeId = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId); long leaderId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); - StudyOnceSearchResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); + StudyOnceCreateResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); long studyOnceId = searchResponse.getStudyOnceId(); long changingCafeId = cafePersistHelper.persistDefaultCafe().getId(); @@ -538,7 +540,7 @@ void change_cafe_by_leader_only() { long cafeId = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId); long leaderId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); - StudyOnceSearchResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); + StudyOnceCreateResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); long studyOnceId = searchResponse.getStudyOnceId(); long changingCafeId = cafePersistHelper.persistDefaultCafe().getId(); @@ -556,7 +558,7 @@ void findStudyMembers() { long cafeId = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId); long leaderId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); - StudyOnceSearchResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); + StudyOnceCreateResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); long studyOnceId = searchResponse.getStudyOnceId(); long memberId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); studyOnceService.tryJoin(memberId, studyOnceId); @@ -579,7 +581,7 @@ void updateStudyOnce() { long cafeId1 = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId1); long leaderId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); - StudyOnceSearchResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); + StudyOnceCreateResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); long studyOnceId = searchResponse.getStudyOnceId(); long cafeId2 = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceUpdateRequest request = new StudyOnceUpdateRequest(cafeId2, "변경된카공이름", start.plusHours(5), @@ -606,7 +608,7 @@ void update_studyOnce_by_invalid_cafe_then_exception() { long cafeId1 = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId1); long leaderId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); - StudyOnceSearchResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); + StudyOnceCreateResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); long studyOnceId = searchResponse.getStudyOnceId(); StudyOnceUpdateRequest request = new StudyOnceUpdateRequest(999L, "변경된카공이름", start.plusHours(5), start.plusHours(6), 5, false); @@ -624,7 +626,7 @@ void update_studyOnce_by_invalid_member_then_exception() { long cafeId1 = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId1); long leaderId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); - StudyOnceSearchResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); + StudyOnceCreateResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); long studyOnceId = searchResponse.getStudyOnceId(); StudyOnceUpdateRequest request = new StudyOnceUpdateRequest(cafeId1, "변경된카공이름", start.plusHours(5), start.plusHours(6), 5, false); @@ -644,7 +646,7 @@ void updateStudyOncePartially() { long cafeId1 = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId1); long leaderId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); - StudyOnceSearchResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); + StudyOnceCreateResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); long memberId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); long studyOnceId = searchResponse.getStudyOnceId(); long cafeId2 = cafePersistHelper.persistDefaultCafe().getId(); @@ -674,7 +676,7 @@ void update_studyOnce_partially_then_update_partially() { long cafeId1 = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId1); long leaderId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); - StudyOnceSearchResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); + StudyOnceCreateResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); long memberId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); long studyOnceId = searchResponse.getStudyOnceId(); long cafeId2 = cafePersistHelper.persistDefaultCafe().getId(); @@ -704,7 +706,7 @@ void update_studyOnce_partially_by_invalid_member_then_exception() { long cafeId1 = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId1); long leaderId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); - StudyOnceSearchResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); + StudyOnceCreateResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); long studyOnceId = searchResponse.getStudyOnceId(); StudyOnceUpdateRequest request = new StudyOnceUpdateRequest(cafeId1, null, null, null, 5, true); @@ -724,7 +726,7 @@ void doesOnlyStudyLeaderExist() { long cafeId1 = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId1); long leaderId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); - StudyOnceSearchResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); + StudyOnceCreateResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); long studyOnceId = searchResponse.getStudyOnceId(); boolean doesOnlyStudyLeaderExist = studyOnceService.doesOnlyStudyLeaderExist(studyOnceId); @@ -740,7 +742,7 @@ void doesOnlyStudyLeaderExist_with_members() { long cafeId1 = cafePersistHelper.persistDefaultCafe().getId(); StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId1); long leaderId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); - StudyOnceSearchResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); + StudyOnceCreateResponse searchResponse = studyOnceService.createStudy(leaderId, studyOnceCreateRequest); long memberId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); long studyOnceId = searchResponse.getStudyOnceId(); studyOnceService.tryJoin(memberId, studyOnceId);