Skip to content

Commit

Permalink
[merge] 리뷰 작성 시 모임 정보 조회 API
Browse files Browse the repository at this point in the history
[feat] 리뷰 작성 시 모임 정보 조회 API
  • Loading branch information
lreowy authored Sep 6, 2024
2 parents 23096f0 + 4013424 commit cc287c6
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.pickple.server.api.moim.dto.response.MoimCreateResponse;
import com.pickple.server.api.moim.dto.response.MoimDescriptionResponse;
import com.pickple.server.api.moim.dto.response.MoimDetailResponse;
import com.pickple.server.api.moim.dto.response.MoimGetResponse;
import com.pickple.server.api.moim.dto.response.MoimListByHostAndMoimStateGetResponse;
import com.pickple.server.api.moim.dto.response.MoimListByHostGetResponse;
import com.pickple.server.api.moim.service.MoimCommandService;
Expand Down Expand Up @@ -93,4 +94,10 @@ public ApiResponseDto<List<MoimListByHostGetResponse>> getMoimListByHost(@PathVa
return ApiResponseDto.success(SuccessCode.MOIM_LIST_BY_HOST,
moimQueryService.getMoimListByHost(hostId));
}

@GetMapping("/v2/moim/{moimId}/review")
public ApiResponseDto<MoimGetResponse> getMoimForReview(@PathVariable Long moimId) {
return ApiResponseDto.success(SuccessCode.MOIM_FOR_REVIEW_GET_SUCCESS,
moimQueryService.getMoimForReview(moimId));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.pickple.server.api.moim.dto.request.MoimCreateRequest;
import com.pickple.server.api.moim.dto.response.MoimDetailResponse;
import com.pickple.server.api.moim.dto.response.MoimGetResponse;
import com.pickple.server.api.moimsubmission.dto.response.MoimByGuestResponse;
import com.pickple.server.global.common.annotation.HostId;
import com.pickple.server.global.response.ApiResponseDto;
Expand Down Expand Up @@ -116,6 +117,17 @@ ApiResponseDto getMoimListByHostAndMoimState(
@RequestParam String moimState
);


@Operation(summary = "리뷰 작성 시 모임 정보 조회")
@ApiResponses(
value = {
@ApiResponse(responseCode = "20039", description = "리뷰 작성 시 모임 정보 조회 성공"),
@ApiResponse(responseCode = "40404", description = "존재하지 않는 모임입니다.")
}
)
ApiResponseDto<MoimGetResponse> getMoimForReview(
@PathVariable Long moimId

@Operation(summary = "호스트에 해당하는 모임 조회")
@ApiResponses(
value = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.pickple.server.api.moim.dto.response;

import com.pickple.server.api.moim.domain.DateInfo;
import lombok.Builder;

@Builder
public record MoimGetResponse(

String title,

String moimImage,

String hostImage,

String hostNickname,

DateInfo dateList
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.pickple.server.api.moim.dto.response.MoimByCategoryResponse;
import com.pickple.server.api.moim.dto.response.MoimDescriptionResponse;
import com.pickple.server.api.moim.dto.response.MoimDetailResponse;
import com.pickple.server.api.moim.dto.response.MoimGetResponse;
import com.pickple.server.api.moim.dto.response.MoimListByHostAndMoimStateGetResponse;
import com.pickple.server.api.moim.dto.response.MoimListByHostGetResponse;
import com.pickple.server.api.moim.repository.MoimRepository;
Expand Down Expand Up @@ -140,4 +141,16 @@ public List<String> getCategories() {
.map(category -> category.category)
.collect(Collectors.toList());
}

public MoimGetResponse getMoimForReview(Long moimId) {
Moim moim = moimRepository.findMoimByIdOrThrow(moimId);

return MoimGetResponse.builder()
.title(moim.getTitle())
.moimImage(moim.getImageList().getImageUrl1())
.hostImage(moim.getHost().getImageUrl())
.hostNickname(moim.getHost().getNickname())
.dateList(moim.getDateList())
.build();
}
}

0 comments on commit cc287c6

Please sign in to comment.