bug fix for atemschutz
This commit is contained in:
@@ -59,8 +59,10 @@ class AtemschutzController {
|
||||
|
||||
async create(req: Request, res: Response): Promise<void> {
|
||||
try {
|
||||
logger.info('Atemschutz create - raw body:', { body: req.body });
|
||||
const parsed = CreateAtemschutzSchema.safeParse(req.body);
|
||||
if (!parsed.success) {
|
||||
logger.warn('Atemschutz create - validation failed:', { errors: parsed.error.flatten() });
|
||||
res.status(400).json({
|
||||
success: false,
|
||||
message: 'Validierungsfehler',
|
||||
@@ -68,6 +70,7 @@ class AtemschutzController {
|
||||
});
|
||||
return;
|
||||
}
|
||||
logger.info('Atemschutz create - parsed data:', { data: parsed.data });
|
||||
const record = await atemschutzService.create(parsed.data, getUserId(req));
|
||||
res.status(201).json({ success: true, data: record });
|
||||
} catch (error: any) {
|
||||
|
||||
@@ -263,6 +263,16 @@ function Atemschutz() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Debug: show form state in alert so we can see exactly what's being sent
|
||||
const debugPayload = {
|
||||
lehrgang_datum: form.lehrgang_datum || '(empty)',
|
||||
untersuchung_datum: form.untersuchung_datum || '(empty)',
|
||||
untersuchung_gueltig_bis: form.untersuchung_gueltig_bis || '(empty)',
|
||||
leistungstest_datum: form.leistungstest_datum || '(empty)',
|
||||
leistungstest_gueltig_bis: form.leistungstest_gueltig_bis || '(empty)',
|
||||
};
|
||||
alert('DEBUG form dates:\n' + JSON.stringify(debugPayload, null, 2));
|
||||
|
||||
setDialogLoading(true);
|
||||
try {
|
||||
if (editingId) {
|
||||
|
||||
Reference in New Issue
Block a user