Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/#28' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Beakjiyeon committed Apr 6, 2024
2 parents 9b95025 + ee5510e commit 21129b3
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;

Expand All @@ -26,25 +28,22 @@ public AddBoardResponseDto getBoard(@PathVariable("boardId") Long boardId) {
* 사용자가 작성한 일지 목록 조회
*/
@GetMapping("/boards")
public List<AddBoardResponseDto> getMyBoards() {
Long memberId = 1L; // TODO 인증
return boardService.getMyBoards(memberId);
public List<AddBoardResponseDto> getMyBoards(@LoginUsers CustomUserDetails userDetails) {
return boardService.getMyBoards(userDetails.getMemberId());
}

/**
* 사용자가 보지 않은 글 중에서 랜덤 3개 골라 주기
* 밤 12시에 적재된 사용자가 읽지 않은 글을 조회
*/
@GetMapping("/random")
public List<AddBoardResponseDto> getRandomBoards() {
Long memberId = 1L; // TODO 인증
return boardService.getRandomBoards(memberId);
public List<AddBoardResponseDto> 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());
}

Expand Down

0 comments on commit 21129b3

Please sign in to comment.