Skip to content

[박준한] sprint 4 #242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Junanaa
Copy link
Collaborator

@Junanaa Junanaa commented Feb 23, 2025

기본 요구사항

컨트롤러 레이어 구현

  • DiscodeitApplication의 테스트 로직은 삭제하세요.

  • 지금까지 구현한 서비스 로직을 활용해 웹 API를 구현하세요.
    이때 @RequestMapping만 사용해 구현해보세요.

웹 API 요구사항

  • 웹 API의 예외를 전역으로 처리하세요.

API 테스트

웹 API 요구사항

사용자 관리

  • 사용자를 등록할 수 있다.
  • 사용자 정보를 수정할 수 있다.
  • 사용자를 삭제할 수 있다.
  • 모든 사용자를 조회할 수 있다.
  • 사용자의 온라인 상태를 업데이트할 수 있다.

권한 관리

  • 사용자는 로그인할 수 있다.

채널 관리

  • 공개 채널을 생성할 수 있다.
  • 비공개 채널을 생성할 수 있다.
  • 공개 채널의 정보를 수정할 수 있다.
  • 채널을 삭제할 수 있다.
  • 특정 사용자가 볼 수 있는 모든 채널 목록을 조회할 수 있다.

메시지 관리

  • 메시지를 보낼 수 있다.
  • 메시지를 수정할 수 있다.
  • 메시지를 삭제할 수 있다.
  • 특정 채널의 메시지 목록을 조회할 수 있다.

메시지 수신 정보 관리

  • 특정 채널의 메시지 수신 정보를 생성할 수 있다.
  • 특정 채널의 메시지 수신 정보를 수정할 수 있다.
  • 특정 사용자의 메시지 수신 정보를 조회할 수 있다.

바이너리 파일 다운로드

[] 바이너리 파일을 1개 또는 여러 개 조회할 수 있다.

멘토에게

최대한 빠르게 수정해서 다시 업로드 하겠습니다.
미션 3를 완료하지 못하여 모법답안을 이용해 미션4를 진행하였고 심화는 아직 진행중입니다

@youngxpepp youngxpepp self-requested a review February 26, 2025 13:33
Copy link
Collaborator

@youngxpepp youngxpepp left a comment

Choose a reason for hiding this comment

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

준한님 고생하셨습니다👍
파트 1은 유익한 시간이었을까요? 나머지 파트들에서도 만날 기회가 있었으면 좋겠습니다.

전반적으로 깔끔하게 controller와 service 간의 연결을 해주셔서 코드 보는데 편안했습니다ㅎㅎ
아쉬운 점은 요구사항 중 정적 파일 서빙이 빠져있네요😭


import java.util.NoSuchElementException;

@RestControllerAdvice
Copy link
Collaborator

Choose a reason for hiding this comment

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

ControllerAdvice를 써주신 분들도 계시더라구요~?
RestControllerAdvice vs ControllerAdvice 두 개의 차이점을 한번 찾아보셨으면 좋겠습니다!


@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<User> createUser(@RequestBody UserCreateRequest request) {
User user = userService.create(request, Optional.empty());
Copy link
Collaborator

Choose a reason for hiding this comment

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

보통 파라미터엔 Optional을 쓰지 않아요. 우리가 제어할 수 없는 값이기 때문이죠.
다른 사람이 Optional을 넣지 않고 null을 넣을 수도 있는거잖아요?

https://homoefficio.github.io/2019/10/03/Java-Optional-%EB%B0%94%EB%A5%B4%EA%B2%8C-%EC%93%B0%EA%B8%B0/

image

return ResponseEntity.ok(users);
}

@RequestMapping(value = "/{userId}/status", method = RequestMethod.PUT)
Copy link
Collaborator

Choose a reason for hiding this comment

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

따로 userStatus api를 만들지 않고 user 내에서 해결하니까 좋네요! 잘하셨습니다👍
앞으로 리소스가 상하관계에 있다면 이 방법을 적극 활용해보세요!

https://jojoldu.tistory.com/783

return ResponseEntity.noContent().build();
}

@RequestMapping(value = "/channel/{channelId}", method = RequestMethod.GET)
Copy link
Collaborator

Choose a reason for hiding this comment

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

채널과 메시지 어떤 것이 더 상위 계층에 있는 리소스일까요?
user와 userStatus 와의 관계를 한번 생각해보시구 url을 만들어보세요!

Comment on lines +35 to +36
@RequestMapping(value = "/user/{userId}", method = RequestMethod.GET)
public ResponseEntity<List<ReadStatus>> getReadStatusForUser(@PathVariable UUID userId) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

user와 readStatus는 어떤 관계일까요? 여긴 상하 관계를 찾기가 좀 어려울거에요!
고민해보시면 좋겠습니다!

Comment on lines +21 to +26
// POST: 바이너리 파일 업로드
@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<BinaryContent> createBinaryContent( BinaryContentCreateRequest request) {
BinaryContent binaryContent = binaryContentService.create(request);
return ResponseEntity.status(201).body(binaryContent);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

보통 파일 업로드를 어떻게 구현할까요? 아래 내용 참고하시겠어요?

https://techblog.woowahan.com/11392/

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