1
0
Fork 0
mirror of https://github.com/s-frick/effigenix.git synced 2026-03-28 10:29: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>;

View file

@ -347,7 +347,7 @@ export interface paths {
path?: never;
cookie?: never;
};
get?: never;
get: operations["listRecipes"];
put?: never;
post: operations["createRecipe"];
delete?: never;
@ -388,6 +388,22 @@ export interface paths {
patch?: never;
trace?: never;
};
"/api/recipes/{id}/archive": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
post: operations["archiveRecipe"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/recipes/{id}/activate": {
parameters: {
query?: never;
@ -436,6 +452,22 @@ export interface paths {
patch?: never;
trace?: never;
};
"/api/inventory/stocks/{stockId}/batches": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
post: operations["addBatch"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/customers": {
parameters: {
query?: never;
@ -708,6 +740,22 @@ export interface paths {
patch?: never;
trace?: never;
};
"/api/recipes/{id}": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get: operations["getRecipe"];
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/users/{id}/roles/{roleName}": {
parameters: {
query?: never;
@ -1209,6 +1257,25 @@ export interface components {
/** Format: int32 */
minimumShelfLifeDays?: number | null;
};
AddStockBatchRequest: {
batchId: string;
batchType: string;
quantityAmount: string;
quantityUnit: string;
expiryDate: string;
};
StockBatchResponse: {
id?: string;
batchId?: string;
batchType?: string;
quantityAmount?: number;
quantityUnit?: string;
/** Format: date */
expiryDate?: string;
status?: string;
/** Format: date-time */
receivedAt?: string;
};
CreateCustomerRequest: {
name: string;
/** @enum {string} */
@ -1303,6 +1370,29 @@ export interface components {
priceModel: "FIXED" | "WEIGHT_BASED";
price: number;
};
RecipeSummaryResponse: {
id: string;
name: string;
/** Format: int32 */
version: number;
type: string;
description: string;
/** Format: int32 */
yieldPercentage: number;
/** Format: int32 */
shelfLifeDays?: number | null;
outputQuantity: string;
outputUom: string;
status: string;
/** Format: int32 */
ingredientCount: number;
/** Format: int32 */
stepCount: number;
/** Format: date-time */
createdAt: string;
/** Format: date-time */
updatedAt: string;
};
RemoveCertificateRequest: {
certificateType: string;
issuer?: string;
@ -2156,6 +2246,28 @@ export interface operations {
};
};
};
listRecipes: {
parameters: {
query?: {
status?: string;
};
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"*/*": components["schemas"]["RecipeSummaryResponse"][];
};
};
};
};
createRecipe: {
parameters: {
query?: never;
@ -2232,6 +2344,28 @@ export interface operations {
};
};
};
archiveRecipe: {
parameters: {
query?: never;
header?: never;
path: {
id: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"*/*": components["schemas"]["RecipeResponse"];
};
};
};
};
activateRecipe: {
parameters: {
query?: never;
@ -2325,6 +2459,32 @@ export interface operations {
};
};
};
addBatch: {
parameters: {
query?: never;
header?: never;
path: {
stockId: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["AddStockBatchRequest"];
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"*/*": components["schemas"]["StockBatchResponse"];
};
};
};
};
listCustomers: {
parameters: {
query?: {
@ -2811,6 +2971,28 @@ export interface operations {
};
};
};
getRecipe: {
parameters: {
query?: never;
header?: never;
path: {
id: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"*/*": components["schemas"]["RecipeResponse"];
};
};
};
};
removeRole: {
parameters: {
query?: never;

View file

@ -8,7 +8,9 @@ import type { components } from './generated/api';
// Response DTOs
export type StorageLocationDTO = components['schemas']['StorageLocationResponse'];
export type TemperatureRangeDTO = components['schemas']['TemperatureRangeResponse'];
export type StockBatchDTO = components['schemas']['StockBatchResponse'];
// Request types
export type CreateStorageLocationRequest = components['schemas']['CreateStorageLocationRequest'];
export type UpdateStorageLocationRequest = components['schemas']['UpdateStorageLocationRequest'];
export type AddStockBatchRequest = components['schemas']['AddStockBatchRequest'];

View file

@ -7,6 +7,7 @@ import type { components } from './generated/api';
// Response DTOs
export type RecipeDTO = components['schemas']['RecipeResponse'];
export type RecipeSummaryDTO = components['schemas']['RecipeSummaryResponse'];
export type IngredientDTO = components['schemas']['IngredientResponse'];
export type ProductionStepDTO = components['schemas']['ProductionStepResponse'];