1
0
Fork 0
mirror of https://github.com/s-frick/effigenix.git synced 2026-03-28 12:09:35 +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

@ -24,6 +24,7 @@ export { createArticlesResource } from './resources/articles.js';
export { createCustomersResource } from './resources/customers.js';
export { createStorageLocationsResource } from './resources/storage-locations.js';
export { createRecipesResource } from './resources/recipes.js';
export { createStocksResource } from './resources/stocks.js';
export {
ApiError,
AuthenticationError,
@ -81,11 +82,14 @@ export type {
CreateStorageLocationRequest,
UpdateStorageLocationRequest,
RecipeDTO,
RecipeSummaryDTO,
IngredientDTO,
ProductionStepDTO,
CreateRecipeRequest,
AddRecipeIngredientRequest,
AddProductionStepRequest,
StockBatchDTO,
AddStockBatchRequest,
} from '@effigenix/types';
// Resource types (runtime, stay in resource files)
@ -111,6 +115,8 @@ export type {
export { STORAGE_TYPE_LABELS } from './resources/storage-locations.js';
export type { RecipesResource, RecipeType, RecipeStatus } from './resources/recipes.js';
export { RECIPE_TYPE_LABELS } from './resources/recipes.js';
export type { StocksResource, BatchType } from './resources/stocks.js';
export { BATCH_TYPE_LABELS } from './resources/stocks.js';
import { createApiClient } from './client.js';
import { createAuthResource } from './resources/auth.js';
@ -122,6 +128,7 @@ import { createArticlesResource } from './resources/articles.js';
import { createCustomersResource } from './resources/customers.js';
import { createStorageLocationsResource } from './resources/storage-locations.js';
import { createRecipesResource } from './resources/recipes.js';
import { createStocksResource } from './resources/stocks.js';
import type { TokenProvider } from './token-provider.js';
import type { ApiConfig } from '@effigenix/config';
@ -145,6 +152,7 @@ export function createEffigenixClient(
customers: createCustomersResource(axiosClient),
storageLocations: createStorageLocationsResource(axiosClient),
recipes: createRecipesResource(axiosClient),
stocks: createStocksResource(axiosClient),
};
}

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>;