new features

This commit is contained in:
Matthias Hochmeister
2026-03-23 14:01:39 +01:00
parent d2dc64d54a
commit 3326156b15
35 changed files with 1341 additions and 257 deletions

View File

@@ -56,4 +56,39 @@ const multerOptions: any = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const uploadBestellung: any = multer(multerOptions);
export { UPLOAD_DIR, THUMBNAIL_DIR };
// ── Wartungslog uploads (vehicle/equipment service reports) ──────────────────
const WARTUNG_DIR = path.join(APP_ROOT, 'uploads', 'wartung');
try {
if (!fs.existsSync(WARTUNG_DIR)) {
fs.mkdirSync(WARTUNG_DIR, { recursive: true });
}
} catch (err) {
logger.warn(`Could not create wartung upload directory`, { err });
}
const wartungStorage = multer.diskStorage({
destination(_req: any, _file: any, cb: any) {
cb(null, WARTUNG_DIR);
},
filename(_req: any, file: any, cb: any) {
const uniqueSuffix = `${Date.now()}-${Math.round(Math.random() * 1e9)}`;
const ext = path.extname(file.originalname);
cb(null, `${uniqueSuffix}${ext}`);
},
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const uploadWartung: any = multer({
storage: wartungStorage,
fileFilter(_req: any, file: any, cb: any) {
if (ALLOWED_TYPES.includes(file.mimetype)) {
cb(null, true);
} else {
cb(new Error(`Dateityp ${file.mimetype} ist nicht erlaubt.`));
}
},
limits: { fileSize: 20 * 1024 * 1024 },
});
export { UPLOAD_DIR, THUMBNAIL_DIR, WARTUNG_DIR };