Giter Site home page Giter Site logo

tasddc1226 / wanted-lab Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 57 KB

Django GenericView를 활용한 다국어 지원 자동 완성 검색, 회사명 검색 기능과 생성 REST api 구현 Django 내장 pagination 적용, pytest를 활용한 테스트코드 작성

Python 96.82% Dockerfile 1.08% Shell 2.10%
django-rest-framework docker mysql nginx pytest

wanted-lab's Introduction

header

Hi There! 🙋‍♂️

wanted-lab's People

Contributors

tasddc1226 avatar

Watchers

 avatar  avatar

wanted-lab's Issues

Issue #2 url 순서에 따른 endpoint 도착점 이슈

발생된 이슈

초기에 company.urls.py에 작성해두었던 endpoint에 대한 순서를 아래와 같이 하였었습니다.

  • Before
urlpatterns = [
    path('companies/', CompanyListCreateView.as_view(), name='companies list'),
    path('companies/<str:name>/', CompanyRUDView.as_view(), name='company retrieve'),
    path('companies/search/', CompanySearchView.as_view(), name='search company'),
]

위의 경로처럼 Endpoint를 설정하니.. endpoint search에 대한 동작 자체가 수행되어지지 않았었습니다.
즉 다시말해 자동 완성 검색에 대한 요청을 보내도 위에서 두번째 Url인 search라는 경로로 빠지게 되는 문제였습니다.

이슈 해결

아래와 같이 순서를 변경해주어 이슈를 해결하였습니다.

  • After
urlpatterns = [
    path('', CompanyListCreateView.as_view(), name='companies list'),
    path('search/', CompanySearchView.as_view(), name='search company'),
    path('<str:name>/', CompanyRUDView.as_view(), name='company retrieve'),
]

Issue #1 query로 검색한 회사가 없는 경우

Issue

  • 요청 url
    /api/v1/companies/search?query=없는회사
  • 요청 header
    key: x-wanted-language value: ko

query로 필터링을 하는데 없는 query를 날리면 전체 회사명이 출력되어지고 있음
검색 결과가 없으면 empty list를 return 하도록 변경하기

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.