Skip to content

Commit

Permalink
feat: 임시 API 개발 (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikekks authored Aug 3, 2024
1 parent c55d013 commit eb408c8
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.sopt.makers.crew.main.comment.v2.dto.response.CommentV2GetCommentsResponseDto;
import org.sopt.makers.crew.main.comment.v2.dto.response.CommentV2ReportCommentResponseDto;
import org.sopt.makers.crew.main.comment.v2.dto.response.CommentV2UpdateCommentResponseDto;
import org.sopt.makers.crew.main.common.dto.TempResponseDto;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ModelAttribute;
Expand Down Expand Up @@ -78,4 +79,15 @@ ResponseEntity<Void> mentionUserInComment(
@Parameter(name = "postId", description = "게시글 id", example = "3")})
ResponseEntity<CommentV2GetCommentsResponseDto> getComments(
@Valid @ModelAttribute @Parameter(hidden = true) CommentV2GetCommentsQueryDto request, Principal principal);

@Operation(summary = "[TEMP] 모임 게시글 댓글 리스트 조회")
@ResponseStatus(HttpStatus.OK)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "성공"),
})
@Parameters({@Parameter(name = "page", description = "페이지, default = 1", example = "1"),
@Parameter(name = "take", description = "가져올 데이터 개수, default = 12", example = "50"),
@Parameter(name = "postId", description = "게시글 id", example = "3")})
ResponseEntity<TempResponseDto<CommentV2GetCommentsResponseDto>> getCommentsTemp(
@Valid @ModelAttribute @Parameter(hidden = true) CommentV2GetCommentsQueryDto request, Principal principal);
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.sopt.makers.crew.main.comment.v2.dto.response.CommentV2ReportCommentResponseDto;
import org.sopt.makers.crew.main.comment.v2.dto.response.CommentV2UpdateCommentResponseDto;
import org.sopt.makers.crew.main.comment.v2.service.CommentV2Service;
import org.sopt.makers.crew.main.common.dto.TempResponseDto;
import org.sopt.makers.crew.main.common.util.UserUtil;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand Down Expand Up @@ -99,4 +100,17 @@ public ResponseEntity<CommentV2GetCommentsResponseDto> getComments(

return ResponseEntity.status(HttpStatus.OK).body(commentDtos);
}

@Override
@GetMapping("/temp")
public ResponseEntity<TempResponseDto<CommentV2GetCommentsResponseDto>> getCommentsTemp(
@Valid @ModelAttribute @Parameter(hidden = true) CommentV2GetCommentsQueryDto request,
Principal principal) {

Integer userId = UserUtil.getUserId(principal);
CommentV2GetCommentsResponseDto commentDtos = commentV2Service.getComments(request.getPostId(),
request.getPage(), request.getTake(), userId);

return ResponseEntity.status(HttpStatus.OK).body(TempResponseDto.of(commentDtos));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.sopt.makers.crew.main.common.dto;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public class TempResponseDto<T> {
private T data;

public static <T> TempResponseDto<T> of(T data) {
return new TempResponseDto<T>(data);
}
}

0 comments on commit eb408c8

Please sign in to comment.