-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature/faq #31
Feature/faq #31
Conversation
README.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Swagger๋ฅผ ์ฌ์ฉ ํ ์์ ์ด๋ผ README์์ ์ฌ์ฉ ์์๋ ์์ด๋ ๋ ๊ฒ ๊ฐ์ต๋๋ค.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์.. ๊ทธ ํ
์คํธ ํ ๋ ์ข ํธํ๊ฒ ํ์๋ผ๊ณ ๋ฃ์ด๋๋๋ฐ ์ญ์ ํ๊ฒ ์ต๋๋ค
์์ curl๋ก ํฐ๋ฏธ๋์์ ๋ณต๋ถํด์ ์ค๋ฅ ์๋์ง ํ์ธ์ฐจ. ํด๋ณด๋ ์ฝ๋์
๋๋ท
src/config/settings.py
Outdated
@@ -31,6 +31,11 @@ | |||
# Application definition | |||
|
|||
INSTALLED_APPS = [ | |||
# Add User Application | |||
"faq", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ก์ปฌ ์ ํ๋ฆฌ์ผ์ด์ ๊ณผ ์ธ๋ถ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ๊ตฌ๋ถ๋๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ฐ์ํ๊ฒ ์ต๋๋ค
src/config/urls.py
Outdated
from faq.views import FAQViewSet | ||
|
||
router = DefaultRouter() | ||
router.register(r'faqs', FAQViewSet, basename="faq") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FAQ์ router๋ faq.urls ๋ชจ๋์์ ๊ด๋ฆฌํ๋ ๊ฒ ์ข์ ๊ฒ ๊ฐ์๋ฐ ๋ค๋ฅธ๋ถ๋ค ์๊ฒฌ์ ์ด๋ ์ ๊ฐ์?
src/config/urls.py
Outdated
path('admin/', admin.site.urls), | ||
path('api/schema/', SpectacularAPIView.as_view(), name='schema'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Swagger์ redoc ๋ฌธ์๋ Debug ํ๊ฒฝ ํน์ ๊ฐ๋ฐ ํ๊ฒฝ์์๋ง ๋ณด์ด๋๊ฒ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if settings.DEBUG:
์ฌ์ฉํด์ ํด๋น ๋ด์ฉ ๋ฐ์ํ ์ ์๋๋ก ํ๊ฒ ์ต๋๋ค
src/faq/models.py
Outdated
1. id : ๊ฒ์๋ฌผ์ ๊ณ ์ id | ||
2. Status : ๊ฒ์๋ฌผ์ ์ํ | ||
""" | ||
id = models.AutoField(primary_key=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apps ๋ชจ๋๊ณผ settings์์ ๊ธฐ๋ณธ ID ํ๋์ ๋ํ ์ ์๊ฐ ์์ด์ BaseModel์ ๋ฐ๋ก ์ ์ํ์ง ์์๋ ๋ ๊ฒ ๊ฐ์ต๋๋ค.
src/faq/models.py
Outdated
def __str__(self): | ||
return self.question | ||
|
||
class Notice(BaseModel): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๊ณต์ง์ฌํญ๋ FAQ ๋๋ฉ์ธ์์ ๊ด๋ฆฌ ํ์๋ ค๋ ๊ฑด๊ฐ์?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notice๋ ๋ฐ๋ก ๋บ๋๋ฐ ์ค์๋ก ์ฝ๋๊ฐ ๊ฐ์ด ๋ค์ด๊ฐ๊ฑฐ ๊ฐ์ต๋๋ค
์์ ํ๊ฒ ์ต๋๋ค.
src/faq/views.py
Outdated
from .serializers import FAQSerializer | ||
|
||
|
||
class FAQPagination(PageNumberPagination): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FAQ ๋ฟ๋ง ์๋๋ผ ๋ค๋ฅธ ViewSet์์๋ ๋์ผํ pagination ์ค์ ์ ์ฌ์ฉํ ๊ฒ ๊ฐ์๋ฐ
๊ธ๋ก๋ฒ์์ ์ ๊ทผํด์ ์ฌ์ฉํ ์ ์๋๋ก ๋ณ๋ ๋ชจ๋๋ก ์ฒ๋ฆฌํ๋ฉด ์ด๋จ๊น์?
settings.py์ ๊ธฐ๋ณธ pagniation ํด๋์ค๋ฅผ ์ง์ ํด์ ์ฌ์ฉํด๋ ๊ด์ฐฎ์ ๊ฒ ๊ฐ์ต๋๋ค.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๊ด๋ จํด์ settings.py์ ์ผ๋จ ๊ธฐ๋ณธ์ค์ (10๊ฐ)์ ๋ฑ๋กํด๋๋๋ฐ
๋ค์ PR์์ ํด๋น ๋ด์ฉ Default ๊ฐ ์ฌ์ฉํ ์ ์๋๋ก ์์ ํ๊ฒ ์ต๋๋ค.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ค๋ง ํ๋ฒ ์์ฒญ์์ ์ต๋ ๊ฐ(max_page_size)์ ์ง์ ํ๋ ค๋ฉด
class๋ก ๊ตฌ์ํด์ผ ํ ๊ฒ ๊ฐ๊ณ
์์ฒญํ๋ ์ต๋๊ฐ์ด ํ์ ์๋ค๊ณ ์๊ฐ๋๋ฉด Default์ ์ ์ํ๊ฑธ ์ฌ์ฉํ๋๋ก ํ๊ฒ ์ต๋๋ค.
๐ก Issue
์ด์
๐ Work Description
code๊ฐ ์ ๋ฌ๋์๋ค๋ ์๋ฏธ๋ก success(200)๋ฅผ ๋ฆฌํด
"status":{} json๊ฐ์ผ๋ก SUCCESS/ERROR ๋ถ๋ฆฌ์ธ ๊ฐ ๋ฆฌํด ํ
โ ํ ์คํธ ํญ๋ชฉ
๐ Reference
ํ๋ก ํธ ํ์ ๋ด์ฉ
๐ Etc