Skip to content

Commit

Permalink
Merge pull request #218 from 2dongyeop/main
Browse files Browse the repository at this point in the history
refactor : 기획 변경으로 인한 수정
  • Loading branch information
2dongyeop authored Nov 20, 2023
2 parents a36bf76 + 3d09025 commit 0b06067
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ private Board createBoard(final CreateBoardRequest request, final Member member)
*/
@Transactional
public void deleteBoard(final Long boardId) {
final Board board = findById(boardId);
board.delete();
boardRepository.deleteById(boardId);
}

/**
Expand Down Expand Up @@ -96,7 +95,7 @@ private void validateUpdateParam(final UpdateBoardRequest request) {
* 게시글 단건 상세 조회
*/
public Board findDetailById(final Long boardId) {
return boardRepository.findDetailById(boardId).orElseThrow(() -> {
return boardRepository.findById(boardId).orElseThrow(() -> {
log.info("boardId[{}] not found", boardId);
return new NotFoundException("게시글 조회 실패");
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public interface BoardRepository extends JpaRepository<Board, Long> {
@Query("select b from Board b" +
" join fetch b.member m" +
" join b.boardReplyList br" +
" where b.id =:id")
" where b.id = :id")
// @Query(value = "SELECT * FROM board WHERE board_id = :id", nativeQuery = true)
Optional<Board> findDetailById(@Param("id") final Long id);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public Page<BoardListDto> boardsByDepartmentUsingPaging(
final List<String> deptNumberList = paramMap.get("dept");
log.info("deptNumberList[{}]", deptNumberList);

if (deptNumberList.isEmpty()) {
if (deptNumberList == null) {
return boardService.findAllUsingPaging(pageable).map(BoardListDto::new);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class BoardListDto {

private Long id;
private String title;
private String body;
private String dept;
Expand All @@ -22,6 +23,7 @@ public class BoardListDto {
private LocalDateTime updateAt;

public BoardListDto(Board board) {
this.id = board.getId();
this.title = board.getTitle();
this.body = board.getBody();
this.dept = board.getDept().toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import static io.wisoft.capstonedesign.global.config.ChatGptConfig.MEDIA_TYPE;

@Slf4j
@Service
public class ChatGptServiceImpl implements ChatGptService {
Expand Down Expand Up @@ -50,7 +52,7 @@ public ChatGptResponseV2 askQuestionV2(final ChatRequest chatRequest) {
//comment: Build headers
private HttpEntity<ChatGptRequest> buildHttpEntity(final ChatGptRequest chatGptRequest) {
final HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.parseMediaType(ChatGptConfig.MEDIA_TYPE));
headers.setContentType(MediaType.parseMediaType(MEDIA_TYPE));
headers.add(ChatGptConfig.AUTHORIZATION, ChatGptConfig.TOKEN_TYPE + ChatGptConfig.API_KEY);
return new HttpEntity<>(chatGptRequest, headers);
}
Expand Down Expand Up @@ -96,7 +98,7 @@ private String getMessage(final ChatRequest chatRequest) {
case "유방함・유방 종괴" -> "유방외과";
case "급격한 체중변화" -> "내분비내과";
case "학습장애・집중력저하" -> "정신건강의학과";
default -> "다시 질문해주세요.";
default -> "질문 게시판을 활용해 보세요.";
};
}
}

0 comments on commit 0b06067

Please sign in to comment.