Skip to content
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

Easily get the last known price of a product #124

Open
raphodn opened this issue Jan 7, 2024 · 2 comments
Open

Easily get the last known price of a product #124

raphodn opened this issue Jan 7, 2024 · 2 comments

Comments

@raphodn
Copy link
Member

raphodn commented Jan 7, 2024

Story

What is the best strategy to efficiently get the last known price of a product ?

Why ?

In the frontend, there are various places where we could display this information to the user :

  • in the list of products, along with it's price count - see New Product price_count field #123
  • when a new price is being added, and the product bar code is scanned, we display information about the product
  • ?
@raphael0202
Copy link
Contributor

raphael0202 commented Jan 15, 2024

Isn't it something we can already do with filtering?
GET /api/v1/prices with product_code={BARCODE} and sort_by=-date and count=1?

@raphodn
Copy link
Member Author

raphodn commented Jan 15, 2024

True !

It was to avoid doing 2 API calls consecutively (first getting the product, and then getting the product's last price)
(or potentially dozens of single calls to /prices to get the last price of a list of products)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

3 participants