mirror of
https://github.com/s-frick/effigenix.git
synced 2026-03-28 13:49:36 +01:00
feat: TUI-Screens für Inventar und Produktion + API-Client Typ-Migration
Neue TUI-Features:
- Inventar: Lageorte auflisten, anlegen, bearbeiten, (de-)aktivieren
- Produktion: Rezepte auflisten, anlegen, Detail-Ansicht
- Navigation erweitert (Hauptmenü, Routing)
API-Client auf generierte OpenAPI-Typen umgestellt:
- 6 neue Alias-Dateien in @effigenix/types (supplier, category, article,
customer, inventory, production)
- api-client Re-Exports direkt von @effigenix/types statt via Resources
- Backend: @Schema(requiredProperties) auf 16 Response-Records
- Backend: OpenApiCustomizer für application-layer DTOs (UserDTO, RoleDTO)
Hinweis: Backend-Endpoints für GET /api/recipes und
GET /api/inventory/storage-locations/{id} fehlen noch (separate Issues).
This commit is contained in:
parent
bee3f28b5f
commit
c26d72fbe7
48 changed files with 2090 additions and 474 deletions
66
frontend/packages/api-client/src/resources/recipes.ts
Normal file
66
frontend/packages/api-client/src/resources/recipes.ts
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
/**
|
||||
* Recipes resource – Production BC.
|
||||
* Endpoints: POST /api/recipes,
|
||||
* POST /api/recipes/{id}/ingredients,
|
||||
* DELETE /api/recipes/{id}/ingredients/{ingredientId}
|
||||
*/
|
||||
|
||||
import type { AxiosInstance } from 'axios';
|
||||
import type {
|
||||
RecipeDTO,
|
||||
IngredientDTO,
|
||||
CreateRecipeRequest,
|
||||
AddRecipeIngredientRequest,
|
||||
} from '@effigenix/types';
|
||||
|
||||
export type RecipeType = 'RAW_MATERIAL' | 'INTERMEDIATE' | 'FINISHED_PRODUCT';
|
||||
export type RecipeStatus = 'DRAFT' | 'ACTIVE' | 'ARCHIVED';
|
||||
|
||||
export const RECIPE_TYPE_LABELS: Record<RecipeType, string> = {
|
||||
RAW_MATERIAL: 'Rohstoff',
|
||||
INTERMEDIATE: 'Halbfabrikat',
|
||||
FINISHED_PRODUCT: 'Fertigprodukt',
|
||||
};
|
||||
|
||||
export type {
|
||||
RecipeDTO,
|
||||
IngredientDTO,
|
||||
CreateRecipeRequest,
|
||||
AddRecipeIngredientRequest,
|
||||
};
|
||||
|
||||
// ── Resource factory ─────────────────────────────────────────────────────────
|
||||
|
||||
const BASE = '/api/recipes';
|
||||
|
||||
export function createRecipesResource(client: AxiosInstance) {
|
||||
return {
|
||||
async list(): Promise<RecipeDTO[]> {
|
||||
const res = await client.get<RecipeDTO[]>(BASE);
|
||||
return res.data;
|
||||
},
|
||||
|
||||
async getById(id: string): Promise<RecipeDTO> {
|
||||
const res = await client.get<RecipeDTO>(`${BASE}/${id}`);
|
||||
return res.data;
|
||||
},
|
||||
|
||||
async create(request: CreateRecipeRequest): Promise<RecipeDTO> {
|
||||
const res = await client.post<RecipeDTO>(BASE, request);
|
||||
return res.data;
|
||||
},
|
||||
|
||||
async addIngredient(id: string, request: AddRecipeIngredientRequest): Promise<RecipeDTO> {
|
||||
const res = await client.post<RecipeDTO>(`${BASE}/${id}/ingredients`, request);
|
||||
return res.data;
|
||||
},
|
||||
|
||||
async removeIngredient(recipeId: string, ingredientId: string): Promise<RecipeDTO> {
|
||||
await client.delete(`${BASE}/${recipeId}/ingredients/${ingredientId}`);
|
||||
const res = await client.get<RecipeDTO>(`${BASE}/${recipeId}`);
|
||||
return res.data;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export type RecipesResource = ReturnType<typeof createRecipesResource>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue