Improve logging for creating new "avoir" entries and address user access issues

Adds detailed debug logging for 'POST AVOIR' requests to aid in troubleshooting user creation and access control problems in production. Includes new console logs to capture received data, validated data, and user information for better debugging. Also includes extensive production logs from various API endpoints, potentially related to user not found errors.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869/p0qYuko
This commit is contained in:
michaelschal committed 2025-09-08 15:16:46 +00:00
1 parent aba66e2312
commit 070daf71ac
3 files changed
+208

No files matched your search

+6
View File
@@ -2409,12 +2409,18 @@ export async function registerRoutes(app: Express): Promise<Server> {
return res.status(404).json({ message: "User not found" });
}
// DEBUG: Log des données reçues
console.log('🔍 [POST AVOIR] Données reçues:', JSON.stringify(req.body, null, 2));
console.log('🔍 [POST AVOIR] User:', { id: user.id, role: user.role });
// Validate data with Zod schema
const validatedData = insertAvoirSchema.parse({
...req.body,
createdBy: user.id,
});
console.log('✅ [POST AVOIR] Données validées:', JSON.stringify(validatedData, null, 2));
// Check if user has access to the specified group
if (user.role !== 'admin' && user.role !== 'directeur') {
const userGroupIds = user.userGroups.map(ug => ug.groupId);