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:
@@ -613,8 +613,23 @@ class BillingService {
|
||||
return { status: 404, response: { success: false, error: 'Abrechnungslauf nicht gefunden' } };
|
||||
}
|
||||
await checkAccess(userToken, run.clubId);
|
||||
if (!run.template) {
|
||||
console.warn('[billing.generateRun] Vorlage fehlt für Run', {
|
||||
runId: run.id,
|
||||
clubId: run.clubId,
|
||||
templateId: run.templateId
|
||||
});
|
||||
return { status: 404, response: { success: false, error: 'Vorlage für diesen Abrechnungslauf nicht gefunden. Bitte neuen Abrechnungslauf mit aktueller Vorlage erstellen.' } };
|
||||
}
|
||||
const resolvedTemplatePath = this._resolveExistingFilePath(run.template?.pdfStoragePath);
|
||||
if (!resolvedTemplatePath) {
|
||||
console.warn('[billing.generateRun] Vorlagen-PDF nicht gefunden', {
|
||||
runId: run.id,
|
||||
clubId: run.clubId,
|
||||
templateId: run.templateId,
|
||||
storedPath: run.template?.pdfStoragePath,
|
||||
cwd: process.cwd()
|
||||
});
|
||||
return { status: 404, response: { success: false, error: 'Vorlagen-PDF nicht gefunden' } };
|
||||
}
|
||||
const computed = await this._collectTrainingSessions(run.clubId, run.periodStart, run.periodEnd);
|
||||
|
||||
Reference in New Issue
Block a user