Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,24 @@ ResponseEntity<CallvanPostSearchResponse> getCallvanPosts(
@UserId Integer userId
);

@ApiResponseCodes({
OK,
NOT_FOUND_ARTICLE
})
@Operation(summary = "콜밴 게시글 요약 정보 조회", description = """
### 콜밴 게시글 요약 정보 조회 API
목록 갱신을 위해 콜밴 게시글 목록 조회에서 출력되는 각 게시글을 단건으로 조회합니다.

#### 비즈니스 로직
1. 존재하지 않는 게시글(`NOT_FOUND_ARTICLE`)이면 예외가 발생합니다.
2. 로그인된 사용자의 경우, 해당 콜벤 게시글에 합류한 상태면 `isJoined` 필드가 true로 표시됩니다.
""")
@GetMapping("/posts/{postId}/summary")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@GetMapping("/posts/{postId}/summary")
@GetMapping("/posts/{postId}")

이런 식으로 하지 않은 이유가 궁금합니당 👀

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GetMapping("/posts/{postId}")
    public ResponseEntity<CallvanPostDetailResponse> getCallvanPostDetail(
        @PathVariable Integer postId,
        @UserId Integer userId
    )

다른 API에서 쓰고 있어요 ㅠ

ResponseEntity<CallvanPostSearchResponse.CallvanPostResponse> getCallvanPostSummary(
@PathVariable Integer postId,
@UserId Integer userId
);

@ApiResponseCodes({
OK,
NOT_FOUND_ARTICLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import in.koreatech.koin.domain.callvan.dto.CallvanPostCreateResponse;
import in.koreatech.koin.domain.callvan.dto.CallvanPostDetailResponse;
import in.koreatech.koin.domain.callvan.dto.CallvanPostSearchResponse;
import in.koreatech.koin.domain.callvan.dto.CallvanPostSearchResponse.CallvanPostResponse;
import in.koreatech.koin.domain.callvan.dto.CallvanUserReportCreateRequest;
import in.koreatech.koin.domain.callvan.model.enums.CallvanLocation;
import in.koreatech.koin.domain.callvan.model.filter.CallvanAuthorFilter;
Expand Down Expand Up @@ -82,6 +83,15 @@ public ResponseEntity<CallvanPostSearchResponse> getCallvanPosts(
return ResponseEntity.ok().body(response);
}

@GetMapping("/posts/{postId}/summary")
public ResponseEntity<CallvanPostResponse> getCallvanPostSummary(
@PathVariable Integer postId,
@UserId Integer userId
) {
CallvanPostResponse response = callvanPostQueryService.getCallvanPostSummary(postId, userId);
return ResponseEntity.ok(response);
}

@GetMapping("/posts/{postId}")
public ResponseEntity<CallvanPostDetailResponse> getCallvanPostDetail(
@PathVariable Integer postId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,11 @@ public CallvanPostDetailResponse getCallvanPostDetail(Integer postId, Integer us

return CallvanPostDetailResponse.from(callvanPost, userId, reportedUserIds);
}

public CallvanPostSearchResponse.CallvanPostResponse getCallvanPostSummary(Integer postId, Integer userId) {
CallvanPost callvanPost = callvanPostRepository.getById(postId);
boolean isJoined =
userId != null && callvanParticipantRepository.existsByPostIdAndMemberIdAndIsDeletedFalse(postId, userId);
return CallvanPostSearchResponse.CallvanPostResponse.from(callvanPost, isJoined, userId);
}
}
Loading