From ee5510effbf27b15d667facdeeb80019102273f2 Mon Sep 17 00:00:00 2001 From: Beakjiyeon Date: Sat, 6 Apr 2024 21:34:39 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=A9=A4=EB=B2=84=20=ED=95=98=EB=93=9C?= =?UTF-8?q?=20=EC=BD=94=EB=94=A9=20=EC=A0=9C=EA=B1=B0=20-=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=20=EC=84=B8=EC=85=98=20=EC=9D=B4=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../board/controller/BoardController.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/unit/daybook/domain/board/controller/BoardController.java b/src/main/java/com/unit/daybook/domain/board/controller/BoardController.java index db7ff7f..81fa6e7 100644 --- a/src/main/java/com/unit/daybook/domain/board/controller/BoardController.java +++ b/src/main/java/com/unit/daybook/domain/board/controller/BoardController.java @@ -4,6 +4,8 @@ import com.unit.daybook.domain.board.dto.response.AddBoardResponseDto; import com.unit.daybook.domain.board.dto.response.BoardTmpResponse; import com.unit.daybook.domain.board.service.BoardService; +import com.unit.daybook.domain.common.annotation.LoginUsers; +import com.unit.daybook.global.config.security.CustomUserDetails; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; @@ -26,9 +28,8 @@ public AddBoardResponseDto getBoard(@PathVariable("boardId") Long boardId) { * 사용자가 작성한 일지 목록 조회 */ @GetMapping("/boards") - public List getMyBoards() { - Long memberId = 1L; // TODO 인증 - return boardService.getMyBoards(memberId); + public List getMyBoards(@LoginUsers CustomUserDetails userDetails) { + return boardService.getMyBoards(userDetails.getMemberId()); } /** @@ -36,15 +37,13 @@ public List getMyBoards() { * 밤 12시에 적재된 사용자가 읽지 않은 글을 조회 */ @GetMapping("/random") - public List getRandomBoards() { - Long memberId = 1L; // TODO 인증 - return boardService.getRandomBoards(memberId); + public List getRandomBoards(@LoginUsers CustomUserDetails userDetails) { + return boardService.getRandomBoards(userDetails.getMemberId()); } @PostMapping - public BoardTmpResponse addBoard(@RequestBody AddBoardRequestDto addBoardRequestDto) { - Long memberId = 1L; // TODO 인증 - AddBoardResponseDto board = boardService.addBoard(addBoardRequestDto, memberId); + public BoardTmpResponse addBoard(@RequestBody AddBoardRequestDto addBoardRequestDto, @LoginUsers CustomUserDetails userDetails) { + AddBoardResponseDto board = boardService.addBoard(addBoardRequestDto, userDetails.getMemberId()); return boardService.getBoardWithHashTag(board.boardId()); }