feat(BillingController, BillingService): enhance billing template handling and error logging
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 41s
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 41s
- Updated billingController to use a dynamic upload directory for billing templates, improving file management. - Added error handling in billingService to log warnings when templates are missing or not found, enhancing debugging capabilities. - Improved user feedback by returning specific error messages when template-related issues occur during billing runs.
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
import fs from 'fs';
|
||||
import multer from 'multer';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import billingService from '../services/billingService.js';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const BILLING_TEMPLATE_UPLOAD_DIR = path.resolve(__dirname, '..', 'uploads', 'billing-templates');
|
||||
|
||||
const storage = multer.diskStorage({
|
||||
destination: (req, file, cb) => {
|
||||
const dir = 'uploads/billing-templates';
|
||||
const dir = BILLING_TEMPLATE_UPLOAD_DIR;
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
cb(null, dir);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user