1
0
Fork 0
mirror of https://github.com/s-frick/effigenix.git synced 2026-03-28 23:13:42 +01:00

feat(frontend): TUI-Screens für Rezept-Filter, Archivierung und Chargen-Einbuchung

Production: Rezeptliste mit Status-Filter (Draft/Active/Archived), Rezept
archivieren für aktive Rezepte, list() gibt RecipeSummaryDTO zurück.
Inventory: Charge einbuchen (AddBatch) mit neuem Stocks-Resource und Screens.
This commit is contained in:
Sebastian Frick 2026-02-19 22:46:38 +01:00
parent f2003a3093
commit ec736cf294
16 changed files with 553 additions and 16 deletions

View file

@ -3,6 +3,7 @@
import type { AxiosInstance } from 'axios';
import type {
RecipeDTO,
RecipeSummaryDTO,
IngredientDTO,
ProductionStepDTO,
CreateRecipeRequest,
@ -21,6 +22,7 @@ export const RECIPE_TYPE_LABELS: Record<RecipeType, string> = {
export type {
RecipeDTO,
RecipeSummaryDTO,
IngredientDTO,
ProductionStepDTO,
CreateRecipeRequest,
@ -34,8 +36,10 @@ const BASE = '/api/recipes';
export function createRecipesResource(client: AxiosInstance) {
return {
async list(): Promise<RecipeDTO[]> {
const res = await client.get<RecipeDTO[]>(BASE);
async list(status?: RecipeStatus): Promise<RecipeSummaryDTO[]> {
const params: Record<string, string> = {};
if (status) params['status'] = status;
const res = await client.get<RecipeSummaryDTO[]>(BASE, { params });
return res.data;
},
@ -71,6 +75,11 @@ export function createRecipesResource(client: AxiosInstance) {
const res = await client.post<RecipeDTO>(`${BASE}/${id}/activate`);
return res.data;
},
async archiveRecipe(id: string): Promise<RecipeDTO> {
const res = await client.post<RecipeDTO>(`${BASE}/${id}/archive`);
return res.data;
},
};
}

View file

@ -0,0 +1,28 @@
/** Stocks resource Inventory BC. */
import type { AxiosInstance } from 'axios';
import type { StockBatchDTO, AddStockBatchRequest } from '@effigenix/types';
export type BatchType = 'PURCHASED' | 'PRODUCED';
export const BATCH_TYPE_LABELS: Record<BatchType, string> = {
PURCHASED: 'Eingekauft',
PRODUCED: 'Produziert',
};
export type { StockBatchDTO, AddStockBatchRequest };
// ── Resource factory ─────────────────────────────────────────────────────────
const BASE = '/api/inventory/stocks';
export function createStocksResource(client: AxiosInstance) {
return {
async addBatch(stockId: string, request: AddStockBatchRequest): Promise<StockBatchDTO> {
const res = await client.post<StockBatchDTO>(`${BASE}/${stockId}/batches`, request);
return res.data;
},
};
}
export type StocksResource = ReturnType<typeof createStocksResource>;