✨ Feat: 게시글 작성 기능 관련 클래스 및 로직 생성#144
Conversation
WhiteBin-bin
left a comment
There was a problem hiding this comment.
코드 리뷰 남긴거 확인하고 수정해줘
| */ | ||
| @Override | ||
| @Transactional | ||
| public Long createBoard(UUID userId, BoardRequest.BoardCreateRequest request) { |
There was a problem hiding this comment.
이거 자바에 static import 라고 있는데 그거써서 BoardRequest.BoardCreateRequest request 이렇게 하지말고 BoardCreateRequest request 이렇게 짧게 수정해줘
| @Transactional | ||
| public Long createBoard(UUID userId, BoardRequest.BoardCreateRequest request) { | ||
|
|
||
| // 작성자 조회 |
There was a problem hiding this comment.
주석은 달지말고 자바독으로 해줘
- 주석 다는거는 테스트에서
// when//given//then이정도만
- BoardCreateRequest / BoardCreateResponse DTO 생성 - 게시글 생성 서비스 로직 생성 - 게시글 작성 API Controller 생성 - BoardRepository를 통한 게시글 저장 처리 로직 생성 - 게시글 관련 예외 처리 및 GlobalExceptionHandler 반영 - BoardServiceTest 생성 Closes DoDo-Project#142
- BoardCreateRequest 타입 import 적용 - createBoard 메서드 시그니처 간소화 - 일반 주석 제거 및 Javadoc으로 변경 - BoardServiceTest 및 BoardControllerTest 수정 (act/테스트 통과) DoDo-Project#144 코드 리뷰 반영
| */ | ||
| @Override | ||
| @Transactional | ||
| public Long createBoard(UUID userId, BoardCreateRequest request) { |
| return toResponseEntity(e.getErrorCode()); | ||
| } | ||
|
|
||
| /** |
There was a problem hiding this comment.
GlobalExceptionHandler에 에러 선언 안하면 오류나니깐 다음부턴 확인하고 올립시당
| // given | ||
| UUID userId = UUID.randomUUID(); | ||
|
|
||
| BoardRequest.BoardCreateRequest request = BoardRequest.BoardCreateRequest.builder() |
There was a problem hiding this comment.
이것도 static import 해줘야지
| )) | ||
| .build(); | ||
|
|
||
| User user = User.builder() |
There was a problem hiding this comment.
이거는 builder 썼는데 아무것도 조합안할거면 그냥 지워도 되는거 아니야?? 이 부분 이상함
| filter.lfs.clean=git-lfs clean -- %f | ||
| filter.lfs.smudge=git-lfs smudge -- %f | ||
| filter.lfs.process=git-lfs filter-process | ||
| filter.lfs.required=true |
WhiteBin-bin
left a comment
There was a problem hiding this comment.
리뷰 남긴거 확인하고 다시 수정해서 올려줘
- BoardCreateRequest 타입 import 적용 - createBoard 메서드 시그니처 간소화 - 일반 주석 제거 및 Javadoc으로 변경 - BoardServiceTest 및 BoardControllerTest 수정 (act/테스트 통과) DoDo-Project#144 코드 리뷰 반영
- BoardCreateRequest 타입 import 적용 - 불필요한 User.builder() 사용 제거 및 mock 기반 객체 생성으로 수정 DoDo-Project#144 코드 리뷰 반영
- BoardCreateRequest 타입 import 적용 - 불필요한 User.builder() 사용 제거 및 mock 기반 객체 생성으로 수정 DoDo-Project#144 코드 리뷰 반영
| @PostMapping | ||
| public ResponseEntity<?> createBoard( | ||
| @RequestBody BoardCreateRequest request, | ||
| Authentication authentication |
There was a problem hiding this comment.
@AuthenticationPrincipal UserDetails userDetails 이 부분은 이런식으로 선언해서 받아와서
UUID userId = UUID.fromString(userDetails.getUsername());
log.info("울타리 거리 범위 설정 요청 - User: {}, PetId: {}", userId, request.getPetId());
return ResponseEntity.ok(fenceService.setFenceRange(userId, request));이런식으로 사용하는거야 다 컨트롤러 부분 고쳐줘
| Long boardId = boardService.createBoard(userId, request); | ||
|
|
||
| return ResponseEntity.status(201) | ||
| .body(Map.of( |
There was a problem hiding this comment.
그리고 우리 status 200종류에서는 200만 사용하기로 했잖어 그것도 수정해줘 내가 컨트롤러에 어떤거 썼는지 보고 참고해서 만들어주고 API 명세도 수정해주고
| public class BoardServiceImpl implements BoardService { | ||
|
|
||
| /** | ||
| * 게시글 저장 / 조회를 위한 JPA Repository |
There was a problem hiding this comment.
JPA Repository라는 말은 빼고 될듯 그냥 Repository로 가면 될거같아
- @AuthenticationPrincipal 기반 사용자 정보 추출로 변경 - 201 → 200 상태코드 변경에 따른 테스트 수정 - Swagger 응답 코드 명세(400, 401, 403, 404, 500) 반영 - 컨트롤러 테스트 인증 방식 및 상태코드 검증 로직 수정 DoDo-Project#144 코드 리뷰 반영
- BoardCreateRequest 타입 import 적용 - 불필요한 User.builder() 사용 제거 및 mock 기반 객체 생성으로 수정
- @AuthenticationPrincipal 기반 사용자 정보 추출로 변경 - 201 → 200 상태코드 변경에 따른 테스트 수정 - Swagger 응답 코드 명세(400, 401, 403, 404, 500) 반영 - 컨트롤러 테스트 인증 방식 및 상태코드 검증 로직 수정 DoDo-Project#144 코드 리뷰 반영
📄 작업 내용 (Description)
🔗 관련 이슈 (Related Issues)
✅ 체크리스트 (Checklist)
Style)Test)📸 스크린샷 (Screenshots)
💬 기타 사항 (Etc)