[강지원] sprint 4#73
Open
jikang24 wants to merge 26 commits intocodeit-bootcamp-spring:강지원from
Hidden character warning
The head ref may contain hidden characters: "\uac15\uc9c0\uc6d0-sprint_misson_4"
Open
Conversation
added 26 commits
January 9, 2026 14:42
joonfluence
reviewed
Feb 14, 2026
|
커밋 메세지에 대한 규칙을 컨벤션으로 한번 더 고민해보시면 좋을 것 같습니다~ |
joonfluence
reviewed
Feb 14, 2026
Comment on lines
+15
to
+18
| @ResponseBody | ||
| @RequestMapping("/api/auth") | ||
| @RequiredArgsConstructor | ||
| @Controller |
There was a problem hiding this comment.
v1 버저닝을 추가 해주는 것도 좋습니다 (계속 버전이 변화될 수 있기 때문에) 나중에 추가하긴 어렵거든요
joonfluence
approved these changes
Feb 14, 2026
Comment on lines
+25
to
+53
| @RequestMapping( | ||
| path = "find", | ||
| method = {RequestMethod.GET} | ||
| ) | ||
| public ResponseEntity<BinaryContent> find( | ||
| @RequestParam("binaryContentId") UUID binaryContentId | ||
| ){ | ||
| BinaryContent binaryContent | ||
| = binaryContentService.find(binaryContentId); | ||
| return ResponseEntity | ||
| .status(HttpStatus.OK) | ||
| .body(binaryContent); | ||
|
|
||
|
|
||
| } | ||
|
|
||
| @RequestMapping( | ||
| path = "findAll", | ||
| method = {RequestMethod.GET} | ||
| ) | ||
| public ResponseEntity<List<BinaryContent>> findAllByIdIn( | ||
| @RequestParam("binaryContentIds") List<UUID> binaryContentIds | ||
| ){ | ||
| List<BinaryContent> binaryContents | ||
| = binaryContentService.findAllByIdIn(binaryContentIds); | ||
| return ResponseEntity | ||
| .status(HttpStatus.OK) | ||
| .body(binaryContents); | ||
| } |
There was a problem hiding this comment.
findById <-> findAllByIdIn
이렇게 분리해야 명확할 것 같네요
Comment on lines
+31
to
+60
| @RequestMapping( | ||
| path = "createPublic", | ||
| consumes = {MediaType.MULTIPART_FORM_DATA_VALUE} | ||
| ) | ||
| public ResponseEntity<Channel> publicChannelCreate( | ||
| @RequestPart("PublicChannelCreateRequest") PublicChannelCreateRequest request | ||
| ){ | ||
| PublicChannelCreateRequest publicChannelCreateRequest | ||
| = new PublicChannelCreateRequest(request.name(), request.description()); | ||
| Channel publicChannel = channelService.create(publicChannelCreateRequest); | ||
| return ResponseEntity | ||
| .status(HttpStatus.CREATED) | ||
| .body(publicChannel); | ||
| } | ||
|
|
||
| @RequestMapping( | ||
| path = "createPrivate", | ||
| consumes = {MediaType.MULTIPART_FORM_DATA_VALUE} | ||
| ) | ||
| public ResponseEntity<Channel> privateChannelCreate( | ||
| @RequestPart("PrivateChannelCreateRequest") | ||
| PrivateChannelCreateRequest request | ||
| ){ | ||
| PrivateChannelCreateRequest privateChannelCreateRequest | ||
| = new PrivateChannelCreateRequest(request.participantIds()); | ||
| Channel privateChannel = channelService.create(privateChannelCreateRequest); | ||
| return ResponseEntity | ||
| .status(HttpStatus.CREATED) | ||
| .body(privateChannel); | ||
| } |
There was a problem hiding this comment.
과제에서 요구사항 대로 하신 것 같아 이해하지만, [POST] "/api/channels/public, private" private, public을 Body 값 안에 넣어서 처리하는 방식이 더 깔끔할 것 같긴 합니다. 정말 분리되어야 하면 모르겠지만 거의 구현 코드가 비슷할거거든요
Comment on lines
+32
to
+70
| @RequestMapping( | ||
| path = "create", | ||
| consumes = {MediaType.MULTIPART_FORM_DATA_VALUE} | ||
| ) | ||
| public ResponseEntity<Message> create( | ||
| @RequestPart("messageCreateRequest") MessageCreateRequest messageCreateRequest, | ||
| @RequestPart(value = "files", required = false) List<MultipartFile> files | ||
| ){ | ||
| List<BinaryContentCreateRequest> binaryAttachments = new ArrayList<>(); | ||
|
|
||
| if (files != null) { | ||
| for (MultipartFile file : files) { | ||
| try { | ||
| binaryAttachments.add( | ||
| new BinaryContentCreateRequest( | ||
| file.getOriginalFilename(), | ||
| file.getContentType(), | ||
| file.getBytes() | ||
| ) | ||
| ); | ||
| } catch (IOException e) { | ||
| throw new RuntimeException(e); | ||
| } | ||
| System.out.println(file.getOriginalFilename()); | ||
| System.out.println(file.getSize()); | ||
| System.out.println(file.getContentType()); | ||
|
|
||
| } | ||
| } | ||
|
|
||
| Message createdMessage = | ||
| messageService.create(messageCreateRequest, binaryAttachments); | ||
|
|
||
| return ResponseEntity | ||
| .status(HttpStatus.CREATED) | ||
| .body(createdMessage); | ||
|
|
||
|
|
||
| } |
| byte[] bytes = attachmentRequest.bytes(); | ||
|
|
||
| BinaryContent binaryContent = new BinaryContent(fileName, (long) bytes.length, contentType, bytes); | ||
| BinaryContent createdBinaryContent = binaryContentRepository.save(binaryContent); |
There was a problem hiding this comment.
부수효과 없이 작성하기 위해 데이터 수정/생성 작업은 외부로 빼서 for-each 에서 최종적으로 수행하는 편이 좋습니다!
| path = "findAll", | ||
| method = {RequestMethod.GET} | ||
| ) | ||
| public ResponseEntity<List<BinaryContent>> findAllByIdIn( |
There was a problem hiding this comment.
지금 Entity 바로 반환하고 있는데 ResponseDto 만들어서 반환하는게 좋긴 해요. 그 이유에 대해선 한번 AI에 물어봐보세요!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
요구사항
기본
컨트롤러 레이어 구현
DiscodeitApplication의 테스트 로직은 삭제하세요.
지금까지 구현한 서비스 로직을 활용해 웹 API를 구현하세요. 이때 @RequestMapping만 사용해 구현해보세요.
웹 API의 예외를 전역으로 처리하세요.
웹 API 요구사항
사용자 관리
권한 관리
채널 관리
메시지 관리
메시지 수신 정보 관리
바이너리 파일 다운로드
API 테스트
심화
정적 리소스 서빙
[ ] 사용자 목록 조회
url: /api/user/findAll
요청
파라미터, 바디 없음
응답
ResponseEntity<List>
url: /api/binaryContent/find
요청
파라미터: binaryContentId
바디 없음
응답: ResponseEntity
생성형 AI 활용
주요 변경사항
https://blog.naver.com/minju1420
@pocco_gk
스크린샷
포스트맨
https://documenter.getpostman.com/view/52123577/2sBXcBnh7q
멘토에게