Open
Conversation
joonfluence
reviewed
Feb 14, 2026
Comment on lines
+27
to
+33
| // 첨부 파일 단건 조회 | ||
| @RequestMapping(value = "/find", method = RequestMethod.GET) | ||
| public ResponseEntity<BinaryContentEntity> findById (@RequestParam UUID binaryContentId) { | ||
| BinaryContentEntity binaryContent = binaryContentService.findEntityById(binaryContentId); | ||
|
|
||
| return ResponseEntity.ok(binaryContent); | ||
| } |
Collaborator
There was a problem hiding this comment.
RESTFul API에서 GET이 이미 자원에 대한 조회의 의미를 내포하기 때문에 /find 굳이 추가할 필요 없습니다!
joonfluence
approved these changes
Feb 14, 2026
Comment on lines
+16
to
+20
| @RestController | ||
| @RequestMapping("/api") | ||
| @RequiredArgsConstructor | ||
| public class ChannelController { | ||
| private final ChannelService channelService; |
Collaborator
There was a problem hiding this comment.
v1 버저닝을 추가 해주는 것도 좋습니다 (계속 버전이 변화될 수 있기 때문에) 나중에 추가하긴 어렵거든요
Comment on lines
+30
to
+36
| // 비공개 채널 생성 | ||
| @RequestMapping(value = "/channel/private", method = RequestMethod.POST) | ||
| public ResponseEntity<ChannelResponseDTO> createPrivateChannel(@RequestBody PrivateChannelCreateRequestDTO privateChannelCreateRequestDTO) { | ||
| ChannelResponseDTO newChannel = channelService.createPrivateChannel(privateChannelCreateRequestDTO); | ||
|
|
||
| return ResponseEntity.status(HttpStatus.CREATED).body(newChannel); | ||
| } |
Collaborator
There was a problem hiding this comment.
과제에서 요구사항 대로 하신 것 같아 이해하지만, [POST] "/api/channels/public, private" private, public을 Body 값 안에 넣어서 처리하는 방식이 더 깔끔할 것 같긴 합니다. 정말 분리되어야 하면 모르겠지만 거의 구현 코드가 비슷할거거든요
Collaborator
There was a problem hiding this comment.
ChannelResponseDTO 별도로 선언해주신 것 좋네요 👍
Comment on lines
+48
to
+59
| userRepository.findById(privateChannelCreateRequestDTO.userId()) | ||
| .orElseThrow(() -> new IllegalArgumentException("해당 사용자가 존재하지 않습니다.")); | ||
|
|
||
| ChannelEntity newChannel = new ChannelEntity(privateChannelCreateRequestDTO); | ||
| channelRepository.save(newChannel); | ||
|
|
||
| List<ReadStatusEntity> newReadStatues = newChannel.getMembers().stream() | ||
| .map(memberId -> new ReadStatusCreateRequestDTO(memberId, newChannel.getId())) | ||
| .map(ReadStatusEntity::new) | ||
| .toList(); | ||
|
|
||
| newReadStatues.forEach(readStatusRepository::save); |
Collaborator
There was a problem hiding this comment.
각각을 별도 private 메서드로 분리해도 좋겠네요
- valiateUserExists
- createChannel
- ...
Comment on lines
+200
to
+213
| public ChannelResponseDTO toResponseDTO(ChannelEntity channel) { | ||
| return ChannelResponseDTO.builder() | ||
| .id(channel.getId()) | ||
| .userId(channel.getUserId()) | ||
| .channelName(channel.getChannelName()) | ||
| // 비공개 채널일 때만 member 리스트 반환 | ||
| .members((channel.getType() == ChannelType.PRIVATE)? channel.getMembers() : List.of()) | ||
| .channelType(channel.getType()) | ||
| .description(channel.getDescription()) | ||
| .createdAt(channel.getCreatedAt()) | ||
| .updatedAt(channel.getUpdatedAt()) | ||
| .lastMessageAt(messageRepository.getLastMessageAt(channel.getId())) | ||
| .build(); | ||
| } |
Collaborator
There was a problem hiding this comment.
ResponseDto로 변환하는 역할이 Service의 책임일까요? 한번 고민해보시면 좋을 것 같습니다!
| .orElseThrow(() -> new IllegalArgumentException("해당 채널이 존재하지 않습니다.")); | ||
|
|
||
| // Private 채널은 채널 참여자만 조회 가능 | ||
| if (targetChannel.getType() == ChannelType.PRIVATE && |
Collaborator
There was a problem hiding this comment.
ChannelType.PRIVATE.equals(targetChannel.getType())
| }); | ||
|
|
||
| // 삭제된 사용자가 발행한 메시지 연쇄 삭제 | ||
| List<MessageEntity> deleteMessages = messageRepository.findAll().stream() |
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.
요구사항
기본
웹 API 요구사항
심화
주요 변경사항
스크린샷
Discodeit.postman_collection.json
멘토에게