new features

This commit is contained in:
Matthias Hochmeister
2026-03-23 16:54:09 +01:00
parent 690f260b71
commit 948b211f70
6 changed files with 115 additions and 26 deletions

View File

@@ -113,7 +113,7 @@ class BestellungController {
}
async createOrder(req: Request, res: Response): Promise<void> {
const { bezeichnung, lieferant_id, budget, besteller_id } = req.body;
const { bezeichnung, lieferant_id, budget, besteller_id, positionen } = req.body;
if (!bezeichnung || typeof bezeichnung !== 'string' || bezeichnung.trim().length === 0) {
res.status(400).json({ success: false, message: 'Bezeichnung ist erforderlich' });
return;
@@ -130,6 +130,10 @@ class BestellungController {
res.status(400).json({ success: false, message: 'Ungültige Besteller-ID' });
return;
}
if (positionen != null && !Array.isArray(positionen)) {
res.status(400).json({ success: false, message: 'Positionen muss ein Array sein' });
return;
}
try {
const order = await bestellungService.createOrder(req.body, req.user!.id);
res.status(201).json({ success: true, data: order });