Skip to content

Commit

Permalink
Merge pull request #50 from Cafegory/feature-49
Browse files Browse the repository at this point in the history
[BUILD SUCCESS] Feature 49
  • Loading branch information
robinjoon authored Mar 15, 2024
2 parents 78553ed + dc8f09e commit 1d05444
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@RequiredArgsConstructor
public class CafeBasicInfoResponse {

private final long id;
private final long cafeId;
private final String name;
private final String address;
private final List<BusinessHourResponse> businessHours;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/example/demo/dto/CafeSearchResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@RequiredArgsConstructor
public class CafeSearchResponse {

private final long id;
private final long cafeId;
private final String name;
private final String address;
private final List<BusinessHourResponse> businessHours;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/example/demo/dto/ReviewResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@Builder
public class ReviewResponse {

private final long id;
private final long reviewId;
private final WriterResponse writer;
private final double rate;
private final String content;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@RequiredArgsConstructor
public class ReviewSearchResponse {

private final long id;
private final long reviewId;
private final WriterResponse writer;
private final double rate;
private final String content;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@Builder
public class StudyOnceForCafeResponse {
private long cafeId;
private long id;
private long studyOnceId;
private String name;
private LocalDateTime startDateTime;
private LocalDateTime endDateTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@Data
public class StudyOnceSearchResponse {
private long cafeId;
private long id;
private long studyOnceId;
private String name;
private LocalDateTime startDateTime;
private LocalDateTime endDateTime;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/example/demo/dto/WriterResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@RequiredArgsConstructor
public class WriterResponse {

private final long id;
private final long memberId;
private final String name;
private final String thumbnailImg;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ private List<ReviewResponse> mapToReviewResponseList(CafeImpl findCafe) {
return findCafe.getReviews().stream()
.map(review ->
ReviewResponse.builder()
.id(review.getId())
.reviewId(review.getId())
.writer(
new WriterResponse(review.getMember().getId(),
review.getMember().getName(),
Expand All @@ -201,7 +201,7 @@ private List<StudyOnceForCafeResponse> mapToStudyOnceForCafeResponse(CafeImpl fi
.map(studyOnce ->
StudyOnceForCafeResponse.builder()
.cafeId(findCafe.getId())
.id(studyOnce.getId())
.studyOnceId(studyOnce.getId())
.name(studyOnce.getName())
.startDateTime(studyOnce.getStartDateTime())
.endDateTime(studyOnce.getEndDateTime())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private ReviewImpl findReviewById(Long reviewId) {

private ReviewResponse mapToReviewResponse(ReviewImpl findReview) {
return ReviewResponse.builder()
.id(findReview.getId())
.reviewId(findReview.getId())
.writer(
new WriterResponse(findReview.getMember().getId(),
findReview.getMember().getName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ private static StudyOnceImpl makeNewStudyOnce(StudyOnceCreateRequest studyOnceCr
private static StudyOnceSearchResponse makeStudyOnceSearchResponse(StudyOnceImpl saved, boolean canJoin) {
return StudyOnceSearchResponse.builder()
.cafeId(saved.getCafe().getId())
.id(saved.getId())
.studyOnceId(saved.getId())
.name(saved.getName())
.startDateTime(saved.getStartDateTime())
.endDateTime(saved.getEndDateTime())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ void searchByStudyId() {
long leaderId = initMember();
StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId);
StudyOnceSearchResponse result = studyOnceService.createStudy(leaderId, studyOnceCreateRequest);
StudyOnceSearchResponse studyOnceSearchResponse = studyOnceService.searchByStudyId(result.getId());
assertThat(studyOnceSearchResponse.getId()).isEqualTo(result.getId());
StudyOnceSearchResponse studyOnceSearchResponse = studyOnceService.searchByStudyId(result.getStudyOnceId());
assertThat(studyOnceSearchResponse.getStudyOnceId()).isEqualTo(result.getStudyOnceId());
}

@Test
Expand Down Expand Up @@ -181,7 +181,7 @@ private static StudyOnceSearchResponse makeExpectedStudyOnceCreateResult(long ca
boolean isEnd = false;
return StudyOnceSearchResponse.builder()
.cafeId(cafeId)
.id(result.getId())
.studyOnceId(result.getStudyOnceId())
.name(studyOnceCreateRequest.getName())
.startDateTime(studyOnceCreateRequest.getStartDateTime())
.endDateTime(studyOnceCreateRequest.getEndDateTime())
Expand Down Expand Up @@ -226,7 +226,7 @@ void createFailByAlreadyStudyMember(LocalDateTime start, LocalDateTime end, Loca
long memberId = initMember();
StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId);
StudyOnceSearchResponse study = studyOnceService.createStudy(leaderId, studyOnceCreateRequest);
studyOnceService.tryJoin(memberId, study.getId());
studyOnceService.tryJoin(memberId, study.getStudyOnceId());
// 오른쪽 끝에서 겹침
StudyOnceCreateRequest needToFailStudyOnceCreateRequest = makeStudyOnceCreateRequest(left, right, cafeId);
assertThatThrownBy(() -> studyOnceService.createStudy(memberId, needToFailStudyOnceCreateRequest))
Expand Down Expand Up @@ -267,7 +267,7 @@ void tryJoin() {
StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(LocalDateTime.now().plusHours(4),
LocalDateTime.now().plusHours(7), cafeId);
StudyOnceSearchResponse study = studyOnceService.createStudy(firstMemberId, studyOnceCreateRequest);
studyOnceService.tryJoin(secondMemberId, study.getId());
studyOnceService.tryJoin(secondMemberId, study.getStudyOnceId());
}

@Test
Expand All @@ -280,9 +280,9 @@ void tryJoinFailCauseDuplicate() {
LocalDateTime.now().plusHours(7), cafeId);
StudyOnceSearchResponse study = studyOnceService.createStudy(firstMemberId, studyOnceCreateRequest);
//when
studyOnceService.tryJoin(secondMemberId, study.getId());
studyOnceService.tryJoin(secondMemberId, study.getStudyOnceId());
//then
assertThatThrownBy(() -> studyOnceService.tryJoin(secondMemberId, study.getId()))
assertThatThrownBy(() -> studyOnceService.tryJoin(secondMemberId, study.getStudyOnceId()))
.isInstanceOf(CafegoryException.class)
.hasMessage(STUDY_ONCE_DUPLICATE.getErrorMessage());
}
Expand All @@ -299,14 +299,14 @@ void tryJoinFailCauseConflict(LocalDateTime start, LocalDateTime end, LocalDateT
long cafeId = initCafe();
StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId);
StudyOnceSearchResponse study = studyOnceService.createStudy(firstMemberId, studyOnceCreateRequest);
studyOnceService.tryJoin(secondMemberId, study.getId());
studyOnceService.tryJoin(secondMemberId, study.getStudyOnceId());
//when
StudyOnceCreateRequest conflictStudyOnceCreateRequest = makeStudyOnceCreateRequest(conflictStart, conflictEnd,
cafeId);
StudyOnceSearchResponse conflictStudy = studyOnceService.createStudy(thirdMemberId,
conflictStudyOnceCreateRequest);
//then
assertThatThrownBy(() -> studyOnceService.tryJoin(secondMemberId, conflictStudy.getId()))
assertThatThrownBy(() -> studyOnceService.tryJoin(secondMemberId, conflictStudy.getStudyOnceId()))
.isInstanceOf(CafegoryException.class)
.hasMessage(STUDY_ONCE_CONFLICT_TIME.getErrorMessage());
}
Expand All @@ -328,8 +328,8 @@ void tryQuit() {
long cafeId = initCafe();
StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId);
StudyOnceSearchResponse study = studyOnceService.createStudy(firstMemberId, studyOnceCreateRequest);
studyOnceService.tryJoin(secondMemberId, study.getId());
studyOnceService.tryQuit(secondMemberId, study.getId());
studyOnceService.tryJoin(secondMemberId, study.getStudyOnceId());
studyOnceService.tryQuit(secondMemberId, study.getStudyOnceId());
}

@Test
Expand All @@ -342,7 +342,7 @@ void tryQuitFailCauseNotJoin() {
long cafeId = initCafe();
StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId);
StudyOnceSearchResponse study = studyOnceService.createStudy(firstMemberId, studyOnceCreateRequest);
assertThatThrownBy(() -> studyOnceService.tryQuit(secondMemberId, study.getId()))
assertThatThrownBy(() -> studyOnceService.tryQuit(secondMemberId, study.getStudyOnceId()))
.isInstanceOf(CafegoryException.class)
.hasMessage(STUDY_ONCE_TRY_QUIT_NOT_JOIN.getErrorMessage());
}
Expand All @@ -357,8 +357,8 @@ void tryQuitFailCauseNotOnlyLeader() {
long cafeId = initCafe();
StudyOnceCreateRequest studyOnceCreateRequest = makeStudyOnceCreateRequest(start, end, cafeId);
StudyOnceSearchResponse study = studyOnceService.createStudy(firstMemberId, studyOnceCreateRequest);
studyOnceService.tryJoin(secondMemberId, study.getId());
assertThatThrownBy(() -> studyOnceService.tryQuit(firstMemberId, study.getId()))
studyOnceService.tryJoin(secondMemberId, study.getStudyOnceId());
assertThatThrownBy(() -> studyOnceService.tryQuit(firstMemberId, study.getStudyOnceId()))
.isInstanceOf(CafegoryException.class)
.hasMessage(STUDY_ONCE_LEADER_QUIT_FAIL.getErrorMessage());
}
Expand Down

0 comments on commit 1d05444

Please sign in to comment.