julkascript / cardflow

The open-source Trading Card Game market
MIT License
14 stars 9 forks source link

Backend/future#58 best seller #83

Closed dinocom33 closed 6 months ago

dinocom33 commented 7 months ago

This PR represents the backend part of issue #58 Add best sellers page.

The response to the request looks like this:

[
  {
    "card_name": "Salamangreat Almiraj",
    "set_name": "Maximum Gold: El Dorado",
    "set_code": "MGED",
    "card_image": "https://images.ygoprodeck.com/images/cards/60303245.jpg",
    "lowest_price": 4.5
  },
  {
    "card_name": "Solemn Warning",
    "set_name": "Noble Knights of the Round Table Box Set",
    "set_code": "NKRT",
    "card_image": "https://images.ygoprodeck.com/images/cards/84749824.jpg",
    "lowest_price": 5
  },
  {
    "card_name": "Scapegoat",
    "set_name": "Tournament Pack 7",
    "set_code": "TP7",
    "card_image": "https://images.ygoprodeck.com/images/cards/73915051.jpg",
    "lowest_price": 5
  }
]

If there is need of any additional information or the provided one contains unnecessary information, please let me know.

The request was tested on forty orders and the execution time was about 30ms on average. In the future, when the database becomes very large and if the execution time increases significantly, it can be cached by the frontend or the query can be run nightly by a cron job.