sparcs-kaist / sparcs09

SPARCS 공동구매 시스템 https://09.sparcs.org/
MIT License
2 stars 2 forks source link

choose style: default viewset vs (class based view + custom urls) #41

Closed samjo-nyang closed 7 years ago

samjo-nyang commented 7 years ago

A drf default viewset supports GET, POST for list and GET, PUT, PATCH, DELETE for details

Problem: Our API spec does not support all of them -> need to disable some methods Solution:

  1. disable them by sending error resp (current method)
  2. use class based view + custom urls

Pros and Cons:

  1. no need to declare manual routing (good), redundant code for unsupported API actions (manually send error resp) (bad)
  2. there are no need to write methods that send error resp of unused requests (good), need to manually route urls (bad)

So...? Choose style between 1 and 2, or both (?)

samjo-nyang commented 7 years ago

please refer to

  1. http://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/
  2. http://www.django-rest-framework.org/api-guide/viewsets/
  3. http://www.django-rest-framework.org/api-guide/generic-views/
ktk1012 commented 7 years ago

router 설정이 조금 더 귀찮을거 같다는 생각이 드는데.. ViewSet 메서드에 error response를 보내주는 decorator를 작성할 수 있다면(?) 그게 더 편하지 않을까 싶다는 생각이..

Shavakan commented 7 years ago

7/19 회의에서 지금 상태가 더 좋은 것 같다고 1번으로 하기로 결정되었습니다.

회의에서 결정되었으므로 이슈는 닫도록 하겠습니다.