diff --git a/attached_assets/Pasted-ctions-DATE-CALC-Ann-e-pr-c-dente-2024-08-17-Samedi-GET-api-user-200--1755355425294_1755355425294.txt b/attached_assets/Pasted-ctions-DATE-CALC-Ann-e-pr-c-dente-2024-08-17-Samedi-GET-api-user-200--1755355425294_1755355425294.txt new file mode 100644 index 0000000..0c3a1fe --- /dev/null +++ b/attached_assets/Pasted-ctions-DATE-CALC-Ann-e-pr-c-dente-2024-08-17-Samedi-GET-api-user-200--1755355425294_1755355425294.txt @@ -0,0 +1,205 @@ +ctions + + + + +🗓️ [DATE-CALC] Année précédente: 2024-08-17 (Samedi) + +GET /api/user 200 in 295ms + +GET /api/user 200 in 347ms + +GET /api/user 200 in 348ms + +GET /api/dlc-products/stats 200 in 328ms + +Customer Orders returned: 38 items + +📋 Tasks returned: { + + count: 55, + + userId: 'admin_local', + + userRole: 'admin', + + requestedStoreId: undefined, + + groupIds: undefined, + + taskGroups: [ + + { id: 91, title: 'refaire podium lot assiettes', groupId: 2 }, + + { id: 90, title: 'caisse 1', groupId: 1 }, + + { id: 89, title: 'caisse 3', groupId: 1 } + + ] + +} + +🌤️ [RESPONSE] Weather data prepared: { + + hasCurrentYear: true, + + hasPreviousYear: true, + + location: 'Frouard, France' + +} + +GET /api/customer-orders 200 in 367ms + +GET /api/tasks 200 in 341ms + +GET /api/publicities 200 in 357ms + +GET /api/weather/current 200 in 384ms + +🔗 PRODUCTION: getDeliveries() récupéré 86 livraisons avec relations + +Deliveries returned: 86 items + +GET /api/deliveries 200 in 462ms + +📊 Statistiques calculées: { + + ordersCount: 20, + + deliveriesCount: 42, + + pendingOrdersCount: 8, + + averageDeliveryTime: 0.3611111111111111, + + totalPalettes: 120, + + totalPackages: 36 + +} + +GET /api/stats/monthly 200 in 477ms + +GET /api/groups 200 in 57ms + +📢 Stockage mémoire des annonces initialisé + +GET /api/announcements 200 in 53ms + +GET /api/publicities 200 in 44ms + +🎯 [SERVER] POST /api/announcements endpoint hit + +🎯 [SERVER] Request body: { + + "title": "TEST", + + "content": "TEST", + + "type": "info" + +} + +🎯 [SERVER] User object: { hasClaims: false, hasId: true, userId: 'admin_local' } + +🎯 [SERVER] Extracted userId: admin_local + +🎯 [SERVER] User found: { username: 'admin', role: 'admin', id: 'admin_local' } + +🎯 [SERVER] User is admin, proceeding with validation + +🎯 [SERVER] Error creating announcement: ZodError: [ + + { + + "code": "invalid_type", + + "expected": "string", + + "received": "undefined", + + "path": [ + + "createdBy" + + ], + + "message": "Required" + + } + +] + + at get error [as error] (file:///app/node_modules/zod/v3/types.js:39:31) + + at ZodObject.parse (file:///app/node_modules/zod/v3/types.js:114:22) + + at file:///app/dist/index.js:7601:57 + + at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { + + issues: [ + + { + + code: 'invalid_type', + + expected: 'string', + + received: 'undefined', + + path: [Array], + + message: 'Required' + + } + + ], + + addIssue: [Function (anonymous)], + + addIssues: [Function (anonymous)], + + errors: [ + + { + + code: 'invalid_type', + + expected: 'string', + + received: 'undefined', + + path: [Array], + + message: 'Required' + + } + + ] + +} + +🎯 [SERVER] Validation errors: [ + + { + + code: 'invalid_type', + + expected: 'string', + + received: 'undefined', + + path: [ 'createdBy' ], + + message: 'Required' + + } + +] + +POST /api/announcements 400 in 11ms + +HEAD /api/health 200 in 1ms + diff --git a/attached_assets/image_1755355435711.png b/attached_assets/image_1755355435711.png new file mode 100644 index 0000000..fd8eb34 Binary files /dev/null and b/attached_assets/image_1755355435711.png differ diff --git a/client/src/components/AnnouncementCard.tsx b/client/src/components/AnnouncementCard.tsx index 540ae15..2e482af 100644 --- a/client/src/components/AnnouncementCard.tsx +++ b/client/src/components/AnnouncementCard.tsx @@ -25,7 +25,6 @@ const formSchema = z.object({ title: z.string().min(1, "Le titre est obligatoire"), content: z.string().min(1, "Le contenu est obligatoire"), type: z.enum(["info", "warning", "error", "success"]).default("info"), - storeId: z.number().optional().nullable(), }); export default function AnnouncementCard() { @@ -42,7 +41,6 @@ export default function AnnouncementCard() { title: "", content: "", type: "info", - storeId: undefined, }, }); @@ -53,14 +51,12 @@ export default function AnnouncementCard() { title: editingAnnouncement.title, content: editingAnnouncement.content, type: editingAnnouncement.type as "info" | "warning" | "error" | "success", - storeId: editingAnnouncement.storeId || undefined, }); } else { form.reset({ title: "", content: "", type: "info", - storeId: undefined, }); } }, [editingAnnouncement, form]); @@ -87,11 +83,7 @@ export default function AnnouncementCard() { enabled: !!user, }); - // Fetch groups for admin - const { data: groups = [] } = useQuery({ - queryKey: ['/api/groups'], - enabled: user?.role === 'admin', - }); + // Create/Update announcement mutation const createMutation = useMutation({ @@ -337,31 +329,7 @@ export default function AnnouncementCard() { )} /> - ( - - Magasin (optionnel) - - - - )} - /> +