Skip to content
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

response dto 리팩터링 #123

Open
12 of 13 tasks
Dh3356 opened this issue Oct 4, 2023 · 0 comments
Open
12 of 13 tasks

response dto 리팩터링 #123

Dh3356 opened this issue Oct 4, 2023 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request refactor refactoring code

Comments

@Dh3356
Copy link
Collaborator

Dh3356 commented Oct 4, 2023

Description

httpcode 데코레이터 적용
response dto 구조 리팩터링

Changes

  • responsedto
  • authController
  • authService
  • chaptersController
  • chaptersService
  • learningsController
  • learningsService
  • problemsController
  • problemsService
  • usersController
  • usersService
  • HttpCode 적용
  • API 문서 update

Additional context

response dto 리팩터링에 따라 모든 response body가 변경될 예정 - API 문서 업데이트 예정

  • 기존의 CoreRes를 상속받아 모든 Service 함수 별로 구현했던 방식 제거

  • ResponseDto 객체 구현

  • ResponseDto는 data, meta를 가지는 JSON:API 스타일의 response 방식

  • data는 any[]로, 일반적으로 모든 데이터는 객체 형태로 data[0]에 있음

  • meta는 any[]로, meta 정보가 들어 있음

  • 변경 후, 모든 Controller, Service 함수는 ResponseDto 객체를 반환

  • Exception(Error) 스타일은 그대로 유지

  • 세부 사항은 API 문서에 작성 예정

@Dh3356 Dh3356 added the enhancement New feature or request label Oct 4, 2023
@Dh3356 Dh3356 self-assigned this Oct 4, 2023
@Dh3356 Dh3356 changed the title httpcode 데코레이터 적용 httpcode 데코레이터 적용, response dto 구조 리팩터링 Oct 17, 2023
@Dh3356 Dh3356 changed the title httpcode 데코레이터 적용, response dto 구조 리팩터링 response dto 리팩터링 Oct 17, 2023
Dh3356 added a commit that referenced this issue Oct 17, 2023
- 기존의 CoreRes를 상속받아 모든 Service 함수 별로 구현했던 방식 제거
- ResponseDto 객체 구현
- ResponseDto는 data, meta를 가지는 JSON:API 스타일의 response 방식
- data는 any[]로, 일반적으로 모든 데이터는 객체 형태로 data[0]에 있음
- meta는 any[]로, meta 정보가 들어 있음
- 변경 후, 모든 Controller, Service 함수는 ResponseDto 객체를 반환
- Exception(Error) 스타일은 그대로 유지
Dh3356 added a commit that referenced this issue Oct 17, 2023
Dh3356 added a commit that referenced this issue Oct 17, 2023
Dh3356 added a commit that referenced this issue Oct 17, 2023
Dh3356 added a commit that referenced this issue Oct 17, 2023
Dh3356 added a commit that referenced this issue Oct 17, 2023
@Dh3356 Dh3356 added the refactor refactoring code label Oct 17, 2023
Dh3356 added a commit that referenced this issue Oct 18, 2023
- login, logout은 POST지만 리소스가 생성된 것이 아니기 때문에 200 적용
@Dh3356 Dh3356 added the documentation Improvements or additions to documentation label Oct 18, 2023
Dh3356 added a commit that referenced this issue Oct 18, 2023
- 채점은 리소스 생성 여부보다 응답 성공 여부가 중요한 API
- 이로 인해 POST이고, 정답 시 리소스가 생겅되지만, 200을 응답하도록 설정
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request refactor refactoring code
Projects
None yet
Development

No branches or pull requests

1 participant