Skip to content

Commit

Permalink
refact: post comment fix
Browse files Browse the repository at this point in the history
  • Loading branch information
weejihye committed Jan 19, 2024
1 parent 3b96c94 commit 70ea0a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/main/java/peer/backend/controller/board/BoardController.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@

@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v1/team/board")
@RequestMapping("/api/v1/team")
public class BoardController {

private final BoardService boardService;

@PostMapping("/create")
@PostMapping("/board/create")
public void createBoard(@RequestBody BoardCreateRequest request, Authentication auth) {
boardService.createBoard(request, auth);
}
Expand All @@ -28,12 +28,12 @@ public void createPost(@RequestBody PostCreateRequest request, Authentication au
boardService.createPost(request, auth);
}

@GetMapping("/list/{teamId}")
@GetMapping("/board/list/{teamId}")
public void getBoardList(@PathVariable("teamId") Long teamId, Authentication auth) {
boardService.getBoardList(teamId, auth);
}

@PutMapping("/{boardId}")
@PutMapping("/board/{boardId}")
public void updateBoard(@PathVariable("boardId") Long boardId,
@RequestBody BoardUpdateRequest request, Authentication auth) {
boardService.updateBoard(boardId, request, auth);
Expand All @@ -45,7 +45,7 @@ public void updatePost(@PathVariable("postId") Long postId,
boardService.updatePost(postId, request, auth);
}

@DeleteMapping("/{boardId}")
@DeleteMapping("/board/{boardId}")
public void deleteBoard(@PathVariable("boardId") Long id, Authentication auth) {
boardService.deleteBoard(id, auth);

Expand Down Expand Up @@ -76,7 +76,7 @@ public Page<PostCommentListResponse> getComments(
Authentication auth) {
if (page < 1 || pageSize < 0)
throw new OutOfRangeException("페이지는 1부터 시작합니다.");
return boardService.getComments(postId, page, pageSize, auth);
return boardService.getComments(postId, page - 1, pageSize, auth);
}

@DeleteMapping("/post/comment/{commentId}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public void createComment(PostCommentRequest request, Authentication auth){
User user = User.authenticationToUser(auth);
if (!teamUserRepository.existsByUserIdAndTeamIdAndStatus(
User.authenticationToUser(auth).getId(),
request.getTeamId(),
post.getBoard().getTeam().getId(),
TeamUserStatus.APPROVED))
throw new ForbiddenException("권한이 없습니다.");
post.addComment(request.getContent(), user);
Expand Down

0 comments on commit 70ea0a5

Please sign in to comment.