Conversation
There was a problem hiding this comment.
.gradle 파일이 .gitignore에 있음에도 올라간 것 같네요! 캐시 삭제 후 다시 한번 해보시죠
git rm -rf --cached .
| import java.util.UUID; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/api/channels") |
There was a problem hiding this comment.
v1 버저닝을 추가 해주는 것도 좋습니다 (계속 버전이 변화될 수 있기 때문에) 나중에 추가하긴 어렵거든요
| @RequestMapping(value = "/api/channels/public", method = RequestMethod.POST) | ||
| public ResponseEntity<Channel> createPublicChannel(@RequestBody PublicChannelCreateRequest request) { | ||
| return ResponseEntity.ok(channelService.create(request)); | ||
| } | ||
|
|
||
| // 비공개 채널 생성 | ||
| @RequestMapping(value = "/api/channels/private", method = RequestMethod.POST) | ||
| public ResponseEntity<Channel> createPrivateChannel(@RequestBody PrivateChannelCreateRequest request) { | ||
| return ResponseEntity.ok(channelService.create(request)); | ||
| } |
There was a problem hiding this comment.
과제에서 요구사항 대로 하신 것 같아 이해하지만, [POST] "/api/channels/public, private" private, public을 Body 값 안에 넣어서 처리하는 방식이 더 깔끔할 것 같긴 합니다. 정말 분리되어야 하면 모르겠지만 거의 구현 코드가 비슷할거거든요
| private final MessageService messageService; | ||
|
|
||
| // 메시지 보내기 | ||
| @RequestMapping(value = "/api/messages", method = RequestMethod.POST) |
There was a problem hiding this comment.
Controller 영역에 @RequestMapping("/api/messages") 붙였으면
메서드 영역 위에 굳이 @RequestMapping(value = "/api/messages", method = RequestMethod.POST) 추가 할 필요는 없긴 해요
| @RestController | ||
| @RequiredArgsConstructor |
There was a problem hiding this comment.
여기다 등록하면 메서드 영역에서 중복 등록 안해도 됩니다!
| public class AuthController { | ||
|
|
||
| private final AuthService authService; | ||
| @RequestMapping(value = "/api/auth/login", method = RequestMethod.POST) | ||
| public ResponseEntity<User> login(@RequestBody LoginRequest loginRequest) { | ||
| User user = authService.login(loginRequest); | ||
| return ResponseEntity.ok(user); | ||
| } |
There was a problem hiding this comment.
지금 Entity 바로 반환하고 있는데 ResponseDto 만들어서 반환하는게 좋긴 해요. 그 이유에 대해선 한번 AI에 물어봐보세요!
| @RequestMapping(method = RequestMethod.GET, value = "/api/binaryContents/find") | ||
| public ResponseEntity<BinaryContent> findBinaryContent(@RequestParam UUID binaryContentId) { | ||
| BinaryContent content = binaryContentService.find(binaryContentId); | ||
| return ResponseEntity.ok(content); | ||
| } |
There was a problem hiding this comment.
RESTFul API에서 GET이 이미 자원에 대한 조회의 의미를 내포하기 때문에 /find 굳이 추가할 필요 없습니다
요구사항
기본
컨트롤러 레이어 구현
DiscodeitApplication의 테스트 로직은 삭제하세요.@RequestMapping만 사용).API 테스트
심화
정적 리소스 서빙
스크린샷
멘토에게