mirror of
https://github.com/s-frick/effigenix.git
synced 2026-03-28 15:29:34 +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
|
|
@ -0,0 +1,79 @@
|
|||
/**
|
||||
* StorageLocations resource – Inventory BC.
|
||||
* Endpoints: GET/POST /api/inventory/storage-locations,
|
||||
* PUT /api/inventory/storage-locations/{id},
|
||||
* PATCH /api/inventory/storage-locations/{id}/activate|deactivate
|
||||
*/
|
||||
|
||||
import type { AxiosInstance } from 'axios';
|
||||
import type {
|
||||
StorageLocationDTO,
|
||||
TemperatureRangeDTO,
|
||||
CreateStorageLocationRequest,
|
||||
UpdateStorageLocationRequest,
|
||||
} from '@effigenix/types';
|
||||
|
||||
export type StorageType = 'COLD_ROOM' | 'FREEZER' | 'DRY_STORAGE' | 'DISPLAY_COUNTER' | 'PRODUCTION_AREA';
|
||||
|
||||
export const STORAGE_TYPE_LABELS: Record<StorageType, string> = {
|
||||
COLD_ROOM: 'Kühlraum',
|
||||
FREEZER: 'Tiefkühler',
|
||||
DRY_STORAGE: 'Trockenlager',
|
||||
DISPLAY_COUNTER: 'Vitrine',
|
||||
PRODUCTION_AREA: 'Produktionsbereich',
|
||||
};
|
||||
|
||||
export type {
|
||||
StorageLocationDTO,
|
||||
TemperatureRangeDTO,
|
||||
CreateStorageLocationRequest,
|
||||
UpdateStorageLocationRequest,
|
||||
};
|
||||
|
||||
export interface StorageLocationFilter {
|
||||
storageType?: string;
|
||||
active?: boolean;
|
||||
}
|
||||
|
||||
// ── Resource factory ─────────────────────────────────────────────────────────
|
||||
|
||||
const BASE = '/api/inventory/storage-locations';
|
||||
|
||||
export function createStorageLocationsResource(client: AxiosInstance) {
|
||||
return {
|
||||
async list(filter?: StorageLocationFilter): Promise<StorageLocationDTO[]> {
|
||||
const params: Record<string, string> = {};
|
||||
if (filter?.storageType) params['storageType'] = filter.storageType;
|
||||
if (filter?.active !== undefined) params['active'] = String(filter.active);
|
||||
const res = await client.get<StorageLocationDTO[]>(BASE, { params });
|
||||
return res.data;
|
||||
},
|
||||
|
||||
async getById(id: string): Promise<StorageLocationDTO> {
|
||||
const res = await client.get<StorageLocationDTO>(`${BASE}/${id}`);
|
||||
return res.data;
|
||||
},
|
||||
|
||||
async create(request: CreateStorageLocationRequest): Promise<StorageLocationDTO> {
|
||||
const res = await client.post<StorageLocationDTO>(BASE, request);
|
||||
return res.data;
|
||||
},
|
||||
|
||||
async update(id: string, request: UpdateStorageLocationRequest): Promise<StorageLocationDTO> {
|
||||
const res = await client.put<StorageLocationDTO>(`${BASE}/${id}`, request);
|
||||
return res.data;
|
||||
},
|
||||
|
||||
async activate(id: string): Promise<StorageLocationDTO> {
|
||||
const res = await client.patch<StorageLocationDTO>(`${BASE}/${id}/activate`);
|
||||
return res.data;
|
||||
},
|
||||
|
||||
async deactivate(id: string): Promise<StorageLocationDTO> {
|
||||
const res = await client.patch<StorageLocationDTO>(`${BASE}/${id}/deactivate`);
|
||||
return res.data;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export type StorageLocationsResource = ReturnType<typeof createStorageLocationsResource>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue