mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-12 01:37:40 +02:00
Merge pull request #188 from R0m1k3/1.1
Remove store selection and simplify announcement creation
This commit is contained in:
4 files changed
+212
-36
No files matched your search
+205
@@ -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
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 341 KiB |
@@ -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<any[]>({
|
||||
queryKey: ['/api/groups'],
|
||||
enabled: user?.role === 'admin',
|
||||
});
|
||||
|
||||
|
||||
// Create/Update announcement mutation
|
||||
const createMutation = useMutation({
|
||||
@@ -337,31 +329,7 @@ export default function AnnouncementCard() {
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="storeId"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Magasin (optionnel)</FormLabel>
|
||||
<Select onValueChange={(value) => field.onChange(value === 'all' ? null : parseInt(value))}>
|
||||
<FormControl>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Tous les magasins" />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
<SelectItem value="all">Tous les magasins</SelectItem>
|
||||
{groups.map((group: any) => (
|
||||
<SelectItem key={group.id} value={group.id.toString()}>
|
||||
{group.name}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<div className="flex justify-end space-x-2 pt-4">
|
||||
<Button
|
||||
type="button"
|
||||
|
||||
+5
-2
@@ -3058,8 +3058,11 @@ RÉSUMÉ DU SCAN
|
||||
console.log('🎯 [SERVER] User is admin, proceeding with validation');
|
||||
|
||||
const announcementData = insertAnnouncementSchema.parse({
|
||||
...req.body,
|
||||
authorId: user.id,
|
||||
title: req.body.title,
|
||||
content: req.body.content,
|
||||
type: req.body.type || 'info',
|
||||
storeId: null, // Toutes les annonces sont globales
|
||||
createdBy: user.id,
|
||||
});
|
||||
|
||||
console.log('🎯 [SERVER] Announcement data validated:', announcementData);
|
||||
|
||||
Reference in new issue
Block a user