v0.1.11b fixes

This commit is contained in:
2026-06-03 15:09:21 +12:00
parent cf968e802b
commit daa6e60a69
11 changed files with 304 additions and 43 deletions
+17
View File
@@ -20,6 +20,7 @@ import type {
ClientUserUpdateInput,
LoginResponse,
EditorMixUpdateInput,
EditorProductFormula,
EditorProductRow,
EditorProductUpdateInput,
MixCalculatorCreateInput,
@@ -340,6 +341,22 @@ export const api = {
method: 'PATCH',
body: JSON.stringify(payload)
}, 'client'),
editorProductFormula: (productId: number) =>
request<EditorProductFormula>(`/api/editor/products/${productId}/ingredients`, {}, 'client'),
addEditorProductIngredient: (productId: number, payload: { raw_material_id: number; quantity_kg: number; notes?: string | null }) =>
request<EditorProductFormula>(`/api/editor/products/${productId}/ingredients`, {
method: 'POST',
body: JSON.stringify(payload)
}, 'client'),
updateEditorProductIngredient: (productId: number, ingredientId: number, payload: MixIngredientUpdateInput) =>
request<EditorProductFormula>(`/api/editor/products/${productId}/ingredients/${ingredientId}`, {
method: 'PATCH',
body: JSON.stringify(payload)
}, 'client'),
deleteEditorProductIngredient: (productId: number, ingredientId: number) =>
request<EditorProductFormula>(`/api/editor/products/${productId}/ingredients/${ingredientId}`, {
method: 'DELETE'
}, 'client'),
productCosts: (fetcher?: ApiFetch) =>
cachedFetchJson<ProductCostBreakdown[]>('/api/powerbi/product-costs', mockCosts, 'client', fetcher),
scenarios: (fetcher?: ApiFetch) => cachedFetchJson<Scenario[]>('/api/scenarios', mockScenarios, 'client', fetcher),