feat(backend): move product pricing to async persisted jobs
This commit is contained in:
parent
c869f88db2
commit
0e439b4ca7
18 changed files with 468 additions and 67 deletions
|
|
@ -9,6 +9,7 @@ import type {
|
|||
MedicationUsage,
|
||||
PartOfDay,
|
||||
Product,
|
||||
ProductSummary,
|
||||
ProductContext,
|
||||
ProductEffectProfile,
|
||||
ProductInventory,
|
||||
|
|
@ -70,6 +71,20 @@ export function getProducts(
|
|||
return api.get(`/products${qs ? `?${qs}` : ""}`);
|
||||
}
|
||||
|
||||
export function getProductSummaries(
|
||||
params: ProductListParams = {},
|
||||
): Promise<ProductSummary[]> {
|
||||
const q = new URLSearchParams();
|
||||
if (params.category) q.set("category", params.category);
|
||||
if (params.brand) q.set("brand", params.brand);
|
||||
if (params.targets) params.targets.forEach((t) => q.append("targets", t));
|
||||
if (params.is_medication != null)
|
||||
q.set("is_medication", String(params.is_medication));
|
||||
if (params.is_tool != null) q.set("is_tool", String(params.is_tool));
|
||||
const qs = q.toString();
|
||||
return api.get(`/products/summary${qs ? `?${qs}` : ""}`);
|
||||
}
|
||||
|
||||
export const getProduct = (id: string): Promise<Product> =>
|
||||
api.get(`/products/${id}`);
|
||||
export const createProduct = (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue