Skip to content

Comments

[박린] Sprint4#135

Open
boolynn17 wants to merge 17 commits intocodeit-bootcamp-spring:박린from
boolynn17:sprint4
Open

[박린] Sprint4#135
boolynn17 wants to merge 17 commits intocodeit-bootcamp-spring:박린from
boolynn17:sprint4

Conversation

@boolynn17
Copy link
Collaborator

@boolynn17 boolynn17 commented Feb 11, 2026

요구사항

기본

컨트롤러 레이어 구현

  • DiscodeitApplication의 테스트 로직은 삭제하세요.
  • 지금까지 구현한 서비스 로직을 활용해 웹 API를 구현하세요(@RequestMapping만 사용).
  • 웹 API의 예외를 전역으로 처리하세요.

API 테스트

  • Postman을 활용해 컨트롤러를 테스트 하세요.

심화

정적 리소스 서빙

  • 사용자 목록 조회, BinaryContent 파일 조회 API를 수정하세요.
  • 사용자 목록을 보여주는 화면을 서빙해보세요.

스크린샷

image

멘토에게

  • 셀프 코드 리뷰를 통해 질문 이어가겠습니다.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.gradle 파일이 .gitignore에 있음에도 올라간 것 같네요! 캐시 삭제 후 다시 한번 해보시죠

git rm -rf --cached .

import java.util.UUID;

@RestController
@RequestMapping("/api/channels")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v1 버저닝을 추가 해주는 것도 좋습니다 (계속 버전이 변화될 수 있기 때문에) 나중에 추가하긴 어렵거든요

Comment on lines +23 to +32
@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));
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

과제에서 요구사항 대로 하신 것 같아 이해하지만, [POST] "/api/channels/public, private" private, public을 Body 값 안에 넣어서 처리하는 방식이 더 깔끔할 것 같긴 합니다. 정말 분리되어야 하면 모르겠지만 거의 구현 코드가 비슷할거거든요

private final MessageService messageService;

// 메시지 보내기
@RequestMapping(value = "/api/messages", method = RequestMethod.POST)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Controller 영역에 @RequestMapping("/api/messages") 붙였으면
메서드 영역 위에 굳이 @RequestMapping(value = "/api/messages", method = RequestMethod.POST) 추가 할 필요는 없긴 해요

Comment on lines +19 to +20
@RestController
@RequiredArgsConstructor
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기다 등록하면 메서드 영역에서 중복 등록 안해도 됩니다!

Comment on lines +12 to +19
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);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지금 Entity 바로 반환하고 있는데 ResponseDto 만들어서 반환하는게 좋긴 해요. 그 이유에 대해선 한번 AI에 물어봐보세요!

Comment on lines +17 to +21
@RequestMapping(method = RequestMethod.GET, value = "/api/binaryContents/find")
public ResponseEntity<BinaryContent> findBinaryContent(@RequestParam UUID binaryContentId) {
BinaryContent content = binaryContentService.find(binaryContentId);
return ResponseEntity.ok(content);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RESTFul API에서 GET이 이미 자원에 대한 조회의 의미를 내포하기 때문에 /find 굳이 추가할 필요 없습니다

Copy link
Collaborator

@joonfluence joonfluence left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants