new features
This commit is contained in:
@@ -364,7 +364,7 @@ class BestellungController {
|
||||
res.status(400).json({ success: false, message: 'Ungültige Bestellungs-ID' });
|
||||
return;
|
||||
}
|
||||
const { nachricht, faellig_am } = req.body;
|
||||
const { faellig_am } = req.body;
|
||||
if (!faellig_am) {
|
||||
res.status(400).json({ success: false, message: 'Fälligkeitsdatum ist erforderlich' });
|
||||
return;
|
||||
|
||||
@@ -394,7 +394,8 @@ class EquipmentController {
|
||||
|
||||
async getStatusHistory(req: Request, res: Response): Promise<void> {
|
||||
try {
|
||||
const history = await equipmentService.getStatusHistory(req.params.id);
|
||||
const { id } = req.params as Record<string, string>;
|
||||
const history = await equipmentService.getStatusHistory(id);
|
||||
res.status(200).json({ success: true, data: history });
|
||||
} catch (error) {
|
||||
logger.error('getStatusHistory error', { error, id: req.params.id });
|
||||
@@ -403,8 +404,9 @@ class EquipmentController {
|
||||
}
|
||||
|
||||
async uploadWartungFile(req: Request, res: Response): Promise<void> {
|
||||
const wartungId = parseInt(req.params.wartungId, 10);
|
||||
if (isNaN(wartungId)) {
|
||||
const { wartungId } = req.params as Record<string, string>;
|
||||
const id = parseInt(wartungId, 10);
|
||||
if (isNaN(id)) {
|
||||
res.status(400).json({ success: false, message: 'Ungültige Wartungs-ID' });
|
||||
return;
|
||||
}
|
||||
@@ -414,7 +416,7 @@ class EquipmentController {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const result = await equipmentService.updateWartungslogFile(wartungId, file.path);
|
||||
const result = await equipmentService.updateWartungslogFile(id, file.path);
|
||||
res.status(200).json({ success: true, data: result });
|
||||
} catch (error) {
|
||||
logger.error('uploadWartungFile error', { error, wartungId });
|
||||
|
||||
@@ -375,7 +375,8 @@ class VehicleController {
|
||||
|
||||
async getStatusHistory(req: Request, res: Response): Promise<void> {
|
||||
try {
|
||||
const history = await vehicleService.getStatusHistory(req.params.id);
|
||||
const { id } = req.params as Record<string, string>;
|
||||
const history = await vehicleService.getStatusHistory(id);
|
||||
res.status(200).json({ success: true, data: history });
|
||||
} catch (error) {
|
||||
logger.error('getStatusHistory error', { error, id: req.params.id });
|
||||
@@ -384,8 +385,9 @@ class VehicleController {
|
||||
}
|
||||
|
||||
async uploadWartungFile(req: Request, res: Response): Promise<void> {
|
||||
const wartungId = parseInt(req.params.wartungId, 10);
|
||||
if (isNaN(wartungId)) {
|
||||
const { wartungId } = req.params as Record<string, string>;
|
||||
const id = parseInt(wartungId, 10);
|
||||
if (isNaN(id)) {
|
||||
res.status(400).json({ success: false, message: 'Ungültige Wartungs-ID' });
|
||||
return;
|
||||
}
|
||||
@@ -395,7 +397,7 @@ class VehicleController {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const result = await vehicleService.updateWartungslogFile(wartungId, file.path);
|
||||
const result = await vehicleService.updateWartungslogFile(id, file.path);
|
||||
res.status(200).json({ success: true, data: result });
|
||||
} catch (error) {
|
||||
logger.error('uploadWartungFile error', { error, wartungId });
|
||||
|
||||
@@ -79,7 +79,7 @@ const wartungStorage = multer.diskStorage({
|
||||
});
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export const uploadWartung: any = multer({
|
||||
const wartungOptions: any = {
|
||||
storage: wartungStorage,
|
||||
fileFilter(_req: any, file: any, cb: any) {
|
||||
if (ALLOWED_TYPES.includes(file.mimetype)) {
|
||||
@@ -89,6 +89,9 @@ export const uploadWartung: any = multer({
|
||||
}
|
||||
},
|
||||
limits: { fileSize: 20 * 1024 * 1024 },
|
||||
});
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export const uploadWartung: any = multer(wartungOptions);
|
||||
|
||||
export { UPLOAD_DIR, THUMBNAIL_DIR, WARTUNG_DIR };
|
||||
|
||||
@@ -558,7 +558,7 @@ const WartungTab: React.FC<WartungTabProps> = ({ fahrzeugId, wartungslog, onAdde
|
||||
const file = e.target.files?.[0];
|
||||
if (!file) return;
|
||||
try {
|
||||
await vehiclesApi.uploadWartungFile(entry.id, file);
|
||||
await vehiclesApi.uploadWartungFile(Number(entry.id), file);
|
||||
onAdded();
|
||||
} catch {
|
||||
// silent fail — user can retry
|
||||
|
||||
@@ -5,12 +5,8 @@ import {
|
||||
Button,
|
||||
CircularProgress,
|
||||
Container,
|
||||
FormControl,
|
||||
Grid,
|
||||
InputLabel,
|
||||
MenuItem,
|
||||
Paper,
|
||||
Select,
|
||||
TextField,
|
||||
Typography,
|
||||
} from '@mui/material';
|
||||
@@ -19,8 +15,6 @@ import { useNavigate, useParams } from 'react-router-dom';
|
||||
import DashboardLayout from '../components/dashboard/DashboardLayout';
|
||||
import { vehiclesApi } from '../services/vehicles';
|
||||
import {
|
||||
FahrzeugStatus,
|
||||
FahrzeugStatusLabel,
|
||||
CreateFahrzeugPayload,
|
||||
UpdateFahrzeugPayload,
|
||||
} from '../types/vehicle.types';
|
||||
@@ -33,16 +27,14 @@ interface FormState {
|
||||
kurzname: string;
|
||||
amtliches_kennzeichen: string;
|
||||
fahrgestellnummer: string;
|
||||
baujahr: string; // kept as string for input, parsed on submit
|
||||
baujahr: string;
|
||||
hersteller: string;
|
||||
typ_schluessel: string;
|
||||
besatzung_soll: string;
|
||||
status: FahrzeugStatus;
|
||||
status_bemerkung: string;
|
||||
standort: string;
|
||||
bild_url: string;
|
||||
paragraph57a_faellig_am: string; // ISO date 'YYYY-MM-DD' or ''
|
||||
naechste_wartung_am: string; // ISO date 'YYYY-MM-DD' or ''
|
||||
paragraph57a_faellig_am: string;
|
||||
naechste_wartung_am: string;
|
||||
}
|
||||
|
||||
const EMPTY_FORM: FormState = {
|
||||
@@ -54,8 +46,6 @@ const EMPTY_FORM: FormState = {
|
||||
hersteller: '',
|
||||
typ_schluessel: '',
|
||||
besatzung_soll: '',
|
||||
status: FahrzeugStatus.Einsatzbereit,
|
||||
status_bemerkung: '',
|
||||
standort: 'Feuerwehrhaus',
|
||||
bild_url: '',
|
||||
paragraph57a_faellig_am: '',
|
||||
@@ -102,8 +92,6 @@ function FahrzeugForm() {
|
||||
hersteller: vehicle.hersteller ?? '',
|
||||
typ_schluessel: vehicle.typ_schluessel ?? '',
|
||||
besatzung_soll: vehicle.besatzung_soll ?? '',
|
||||
status: vehicle.status,
|
||||
status_bemerkung: vehicle.status_bemerkung ?? '',
|
||||
standort: vehicle.standort,
|
||||
bild_url: vehicle.bild_url ?? '',
|
||||
paragraph57a_faellig_am: toDateInput(vehicle.paragraph57a_faellig_am),
|
||||
|
||||
Reference in New Issue
Block a user