Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 임시 API 개발 #287

Merged
merged 1 commit into from
Aug 3, 2024
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 @@ -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);
}
}
Loading