Enhance myTischtennis URL controller with improved error handling and logging

Updated MyTischtennisUrlController to include detailed error messages for missing user IDs and team configurations. Added logging for session details and automatic login attempts, improving debugging capabilities. Enhanced request logging for API calls to myTischtennis, ensuring all requests are logged, even in case of errors. Updated requestLoggingMiddleware to only log myTischtennis-related requests, streamlining log management. Improved validation checks in autoFetchMatchResultsService for team and league data integrity.
This commit is contained in:
Torsten Schulz (local)
2025-10-29 18:07:43 +01:00
parent c2b8656783
commit 89329607dc
5 changed files with 295 additions and 50 deletions

View File

@@ -41,8 +41,8 @@ export const requestLoggingMiddleware = async (req, res, next) => {
const ipAddress = req.ip || req.connection.remoteAddress || req.headers['x-forwarded-for'];
const path = req.path || req.url;
// Nur myTischtennis-Requests loggen
// Skip logging for non-data endpoints (Status-Checks, Health-Checks, etc.)
// Nur Daten-Abrufe von API-Endpunkten werden geloggt
// Exclude any endpoint containing 'status' or root paths
if (
path.includes('/status') ||
@@ -54,6 +54,11 @@ export const requestLoggingMiddleware = async (req, res, next) => {
return;
}
// Nur myTischtennis-Endpunkte loggen (z.B. /api/mytischtennis/*)
if (!path.includes('/mytischtennis')) {
return;
}
// Get user ID if available (wird von authMiddleware gesetzt)
const userId = req.user?.id || null;