[박준한] sprint 4#242
Hidden character warning
Conversation
youngxpepp
left a comment
There was a problem hiding this comment.
준한님 고생하셨습니다👍
파트 1은 유익한 시간이었을까요? 나머지 파트들에서도 만날 기회가 있었으면 좋겠습니다.
전반적으로 깔끔하게 controller와 service 간의 연결을 해주셔서 코드 보는데 편안했습니다ㅎㅎ
아쉬운 점은 요구사항 중 정적 파일 서빙이 빠져있네요😭
|
|
||
| import java.util.NoSuchElementException; | ||
|
|
||
| @RestControllerAdvice |
There was a problem hiding this comment.
ControllerAdvice를 써주신 분들도 계시더라구요~?
RestControllerAdvice vs ControllerAdvice 두 개의 차이점을 한번 찾아보셨으면 좋겠습니다!
|
|
||
| @RequestMapping(method = RequestMethod.POST) | ||
| public ResponseEntity<User> createUser(@RequestBody UserCreateRequest request) { | ||
| User user = userService.create(request, Optional.empty()); |
There was a problem hiding this comment.
보통 파라미터엔 Optional을 쓰지 않아요. 우리가 제어할 수 없는 값이기 때문이죠.
다른 사람이 Optional을 넣지 않고 null을 넣을 수도 있는거잖아요?
| return ResponseEntity.ok(users); | ||
| } | ||
|
|
||
| @RequestMapping(value = "/{userId}/status", method = RequestMethod.PUT) |
There was a problem hiding this comment.
따로 userStatus api를 만들지 않고 user 내에서 해결하니까 좋네요! 잘하셨습니다👍
앞으로 리소스가 상하관계에 있다면 이 방법을 적극 활용해보세요!
| return ResponseEntity.noContent().build(); | ||
| } | ||
|
|
||
| @RequestMapping(value = "/channel/{channelId}", method = RequestMethod.GET) |
There was a problem hiding this comment.
채널과 메시지 어떤 것이 더 상위 계층에 있는 리소스일까요?
user와 userStatus 와의 관계를 한번 생각해보시구 url을 만들어보세요!
| @RequestMapping(value = "/user/{userId}", method = RequestMethod.GET) | ||
| public ResponseEntity<List<ReadStatus>> getReadStatusForUser(@PathVariable UUID userId) { |
There was a problem hiding this comment.
user와 readStatus는 어떤 관계일까요? 여긴 상하 관계를 찾기가 좀 어려울거에요!
고민해보시면 좋겠습니다!
| // POST: 바이너리 파일 업로드 | ||
| @RequestMapping(method = RequestMethod.POST) | ||
| public ResponseEntity<BinaryContent> createBinaryContent( BinaryContentCreateRequest request) { | ||
| BinaryContent binaryContent = binaryContentService.create(request); | ||
| return ResponseEntity.status(201).body(binaryContent); | ||
| } |
There was a problem hiding this comment.
보통 파일 업로드를 어떻게 구현할까요? 아래 내용 참고하시겠어요?

기본 요구사항
컨트롤러 레이어 구현
DiscodeitApplication의 테스트 로직은 삭제하세요.
지금까지 구현한 서비스 로직을 활용해 웹 API를 구현하세요.
이때 @RequestMapping만 사용해 구현해보세요.
웹 API 요구사항
API 테스트
Postman API 테스트 결과를 다음과 같이 export하여 PR에 첨부해주세요.
스프린트 미션 4.postman_collection.json
웹 API 요구사항
사용자 관리
권한 관리
채널 관리
메시지 관리
메시지 수신 정보 관리
바이너리 파일 다운로드
[] 바이너리 파일을 1개 또는 여러 개 조회할 수 있다.
멘토에게
최대한 빠르게 수정해서 다시 업로드 하겠습니다.
미션 3를 완료하지 못하여 모법답안을 이용해 미션4를 진행하였고 심화는 아직 진행중입니다