1
0
Fork 0
mirror of https://github.com/s-frick/effigenix.git synced 2026-03-28 17:04:49 +01:00

feat(production): TUI-Screens für Zutaten verwalten + Rezept aktivieren

This commit is contained in:
Sebastian Frick 2026-02-19 21:48:33 +01:00
parent 63f51bc1a9
commit 5224001dd7
6 changed files with 241 additions and 20 deletions

View file

@ -1,9 +1,4 @@
/**
* Recipes resource Production BC.
* Endpoints: POST /api/recipes,
* POST /api/recipes/{id}/ingredients,
* DELETE /api/recipes/{id}/ingredients/{ingredientId}
*/
/** Recipes resource Production BC. */
import type { AxiosInstance } from 'axios';
import type {
@ -59,10 +54,8 @@ export function createRecipesResource(client: AxiosInstance) {
return res.data;
},
async removeIngredient(recipeId: string, ingredientId: string): Promise<RecipeDTO> {
async removeIngredient(recipeId: string, ingredientId: string): Promise<void> {
await client.delete(`${BASE}/${recipeId}/ingredients/${ingredientId}`);
const res = await client.get<RecipeDTO>(`${BASE}/${recipeId}`);
return res.data;
},
async addProductionStep(id: string, request: AddProductionStepRequest): Promise<RecipeDTO> {
@ -73,6 +66,11 @@ export function createRecipesResource(client: AxiosInstance) {
async removeProductionStep(id: string, stepNumber: number): Promise<void> {
await client.delete(`${BASE}/${id}/steps/${stepNumber}`);
},
async activateRecipe(id: string): Promise<RecipeDTO> {
const res = await client.post<RecipeDTO>(`${BASE}/${id}/activate`);
return res.data;
},
};
}