feat(backend): move product pricing to async persisted jobs

This commit is contained in:
Piotr Oleszczyk 2026-03-04 22:46:16 +01:00
parent c869f88db2
commit 0e439b4ca7
18 changed files with 468 additions and 67 deletions

View file

@ -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 = (