Giter Club home page Giter Club logo

backend-quiz's Introduction

DIJI.TECH Backend Quiz

Lütfen aşşağıdaki yönergeleri takip ederek görevleri tamamlayın.

Kurulum

  1. Python env oluşturun
  2. Requirements.txt oluşturun
  3. .gitignore dosyası oluşturun
  4. Aşağıdaki Kütüphanelerin Son Versiyonlarını Kurun
    1. Django
    2. Django Rest Framework
      • Başka kütüphaneye ihtiyacınız varsa kurablirsiniz.
  5. Django projesi oluşturun
  6. Yeni app oluşturun location
  7. Modelleri Ekleyin
    1. Country
      1. name
      2. search_text
      3. search_count
      4. code
      5. phone_code
    2. City
      1. name
      2. search_text
      3. search_count
      4. country
    3. Airport
      1. name
      2. search_text
      3. search_count
      4. code
      5. country
      6. city
  8. Fixture dosyasındaki verileri data migration oluşturarak yükleyin

Ortak Görevler (Tüm modeller için Geçerli)

  1. Location Modellerdeki name,search_text ve search_count zorunlu olmalı eklenmediğinde uygulama hata vermeli
  2. Location appte search_text alanı için bir management komudu oluşturun.
    1. python manage.py XXX
    2. Bu command ile tüm location modeller için search text oluşmalı.
    3. Search text kendi ve üst ilişkideki modellerin name alanını içermeli
      1. Airport => 'airport.name,airport.city.name,airport.country.name'
  3. Location modelleri için XXX.objects.search('Ankara') gibi bir arama yapıldığında en doğru sonuçları getiren .search fonksiyonunu yazın.(models.Manager ve models.QuerySet)
    1. Fonksiyon küçük büyük harf duyarlı olmalı
    2. Unaccent aramalardada sonuç verebilmeli
      1. Örn: Niğde ve NİgDe aynı sonuçları verebilmeli
  4. Aşağıdaki endpointleri oluşturun (Rest Framework)
    1. Tüm Location Modeller için Search End Point
      1. Yukarıda belirtilen search fonksiyonunu kullanarak en fazla 20 tane sonuç getirecek.
    2. Tüm Location Modeller için Select End Point
      1. Bir lokasyonun seçilmesi sağlanır.
      2. Select olduğunda request içine Cookie ile seçili model ve lokasyonun id'si kayıt edilir.
    3. Deselect End Point
      1. Cookieden seçili olan lokasyonu temizler.
  5. Bir lokasyon seçildiğinde search_count'u artmalı
    1. Aynı Zamanda üst ilişkilerininde search_countu artmalı
  6. Eğer atılan request cookilerinde bir lokasyon seçilmiş ise search_count artmalı
    1. Aynı Zamanda üst ilişkilerininde search_countu artmalı
    2. Response 200 kodu ile dönmüyorsa search_count artmamalı.
  7. Eğer yeni bir lokasyon modeli eklenirse örn: Stations tüm yapı bu model içinde çalışmalı

Görevler

  1. Counry Most Searched Cities End Point
    1. Ülke kodu gönderilir ve en çok aranan 5 şehiri listelenir
    2. 1 den fazla ülke kodu gönderilebilir.
    3. Sonuçlar ülkeye göre gruplu gelmelidir.
  2. Country Search Ratio
    1. Ülke kodu gönderilir ve toplam şehir araması sayısı toplam airport arama sayısına bölünüp bir oran çıkarılır.
    2. Bu oranla birlikte ülke bilgileri geri dönülür.
    3. 1 den fazla ülke kodu gönderilebilir.

Notlar

  1. 1 kullanıcı sadece 1 lokasyon seçebilir.

Başlarken

  1. Projeyi fork edip kendi reponuzu oluşturun
  2. gitignore ve requirements.txt dosyanızın doğru bir şekilde oluşturun.
  3. Kodlarınızı olabildiğince temiz ve anlaşılır yazmaya özen gösterin.
  4. Kodlarınızı yazarken bildiğiniz en iyi yöntemler ile yazmaya çalışın.
  5. Görevlerden çok yazdığınız kodun önemli olduğunu unutmayın.

uygulamayı çalıştırmak için dikkat edilmesi gereken bazı noktalar

  1. şehirleri veritabanına yüklemeden önce ülke json'unu yükleyin
  2. ülkeleri ve şehirleri json yükleme komutu aşağıdaki gibidir
python manage.py load_json_data --model ulke --json-file ./path/to/countries.json
python manage.py load_json_data --model sehir --json-file ./path/to/cities.json
  1. to populate the search_text field, use this command
python manage.py generate_search_text
  1. API'mızın URL uç noktası aşağıdaki gibidir
    • api/locations/search?query=istanbul [GET]
    • api/locations/select/[POST] konum seçmeye yönelik uç nokta, bu iki alanı içeren bir json gövdesinin gönderilmesini bekleyen bir gönderi isteğidir:
      1. id
      2. model : "model" alanı üç olası dizeden birini bekler, "country", "city", "airport"
    • api/locations/country-most-searched-cities?country_codes=TR,DE,KE [GET]
    • api/locations/country-search-ratio?country_codes=TR,DE,KE [GET]
    • api/locations/deselect/ [GET]

backend-quiz's People

Contributors

kinstugi avatar omert11 avatar

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.