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

Ticket relationship(Bookmark, Buy) API 앱 분리 #8

Open
jseop-lim opened this issue May 1, 2022 · 0 comments
Open

Ticket relationship(Bookmark, Buy) API 앱 분리 #8

jseop-lim opened this issue May 1, 2022 · 0 comments

Comments

@jseop-lim
Copy link
Collaborator

현행

  • mypage/views 폴더 아래 user_views.py, ticket_views.py 두 파일에 각 기능따라 작성
  • mypage/serializers 폴더 아래 user_serializers.py, ticket_serializers.py 두 파일에 각 용도따라 작성

문제

  • mypage라는 앱 하나가 두 가지 역할을 겸하고 있다.
  • 4요소(M/V/Url/Serializer) 중 2개는 이미 파일 분리했고, url도 사실상 분리 필요.

해결

  1. 현행으로 mypage CRUD 관련하여 단일 앱 유지
    -> 단일 책임 원칙 위배

  2. bookmark, buy 관련 새로운 앱 생성
    -> mypage에는 모델 없고, 새로운 앱의 models.py에 종속적
    -> API gateway도 새로 앱으로 만들 경우, 총 4개의 앱이나 운영하게 됨.

@jseop-lim jseop-lim changed the title Ticket relationship(Bookmark, Buy) CRUD API 앱 분리 Ticket relationship(Bookmark, Buy) API 앱 분리 May 1, 2022
jseop-lim added a commit that referenced this issue May 1, 2022
mypage/views 디렉토리 생성, *_views.py를 아래로 이동
- views.py의 이름을 user_views.py로 변경
- 새로운 파일 ticekt_views.py 생성
urls.py에서 import path 수정

(#8)
jseop-lim added a commit that referenced this issue May 1, 2022
mypage/serializers 디렉토리 생성, *_serializers.py를 아래로 이동
- serializers.py의 이름을 user_serializers.py로 변경
- 새로운 파일 ticket_serializers.py 생성

config/urls.py에서 mypage.urls의 path를 ''로 변경
mypage url path 앞에 'users/' 추가

user serializers, user views 클래스 이름 앞에 User 추가

(#8)
jseop-lim added a commit that referenced this issue May 1, 2022
Bookmark 인스턴스 생성, 삭제 API
(serializer) BookmarkSerializer 정의
(view) CBV로 BookmarkCreateView, BookmarkDestroyView 정의
(url) 'bookmark-list', 'bookmark-detail' 추가

(#6, #8)
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

No branches or pull requests

1 participant