Skip to content

Commit

Permalink
hotfix: 프론트에서 댓글 생성, 삭제 테스트를 위한 임시 코드 주석처리
Browse files Browse the repository at this point in the history
  • Loading branch information
kdkdhoho committed Feb 8, 2024
1 parent 103ae24 commit 8b2ea28
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ public class CommentService {
private final ReplyRepository replyRepository;
private final CommentRepository commentRepository;

public CommentCreateResponse create(Long listId, String accessToken, String content) {
Long userId = jwtManager.read(accessToken);
User user = userRepository.getById(userId);
public CommentCreateResponse create(Long listId, String content) {
// TODO: 프론트 단에서 댓글 생성 테스트 끝나면 원래대로 복구
// Long userId = jwtManager.read(accessToken);
User user = userRepository.getById(1L);
Lists list = listRepository.getById(listId);

Comment comment = Comment.create(list, user, content);
Expand Down Expand Up @@ -70,10 +71,10 @@ public CommentFindResponse getComments(Long listId, int size, Long cursorId) {
return CommentFindResponse.from(totalCount, cursorIdOfResult, hasNext, result);
}

public void delete(Long listId, String accessToken, Long commentId) {

Long userId = jwtManager.read(accessToken);
userRepository.getById(userId);
public void delete(Long listId, Long commentId) {
// TODO: 프론트 단에서 댓글 생성 테스트 끝나면 원래대로 복구
// Long userId = jwtManager.read(accessToken);
// userRepository.getById(userId);
listRepository.getById(listId);

Comment comment = commentRepository.getById(commentId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
Expand All @@ -28,10 +27,10 @@ public class CommentController {
@PostMapping
ResponseEntity<CommentCreateResponse> create(
@PathVariable(value = "listId") Long listId,
@RequestHeader(value = "Authorization", defaultValue = "") String accessToken,
// @RequestHeader(value = "Authorization", defaultValue = "") String accessToken,
@RequestBody CommentCreateRequest commentCreateRequest
) {
CommentCreateResponse response = commentService.create(listId, accessToken, commentCreateRequest.content());
CommentCreateResponse response = commentService.create(listId, commentCreateRequest.content());
return ResponseEntity.status(CREATED).body(response);
}

Expand All @@ -48,10 +47,10 @@ ResponseEntity<CommentFindResponse> getAllCommentsByList(
@DeleteMapping("/{commentId}")
ResponseEntity<Void> delete(
@PathVariable(value = "listId") Long listId,
@RequestHeader(value = "Authorization", defaultValue = "") String accessToken,
// @RequestHeader(value = "Authorization", defaultValue = "") String accessToken,
@PathVariable(value = "commentId") Long commentId
) {
commentService.delete(listId, accessToken, commentId);
commentService.delete(listId, commentId);
return ResponseEntity.noContent().build();
}
}

0 comments on commit 8b2ea28

Please sign in to comment.