Michael and Claude Fable 5
753b301066
perf: add missing indexes and remove N+1 queries
...
The app degraded progressively over a year of data growth. Four causes,
all cumulative:
1. No indexes. Apart from primary keys, unique constraints and
session.expire, no table carried an index. PostgreSQL does not index
foreign keys automatically, so every filter and join on group_id,
supplier_id, order_id and the date columns did a sequential scan.
Worst offender: user_groups.user_id, read by getUserWithGroups() on
every authenticated request.
2. N+1 in the order and delivery listings. getOrders,
getOrdersByDateRange, getDeliveries and getDeliveriesByDateRange
issued one to two queries per row to load relations. Relations are now
loaded in bulk and grouped in Node: three queries regardless of volume.
3. /api/sync-order-delivery-status reloaded the whole deliveries table on
every iteration of its loop over orders. It now uses the deliveries
getOrders() already attaches.
4. clearExpiredCache() was implemented but never called, so
invoice_verification_cache grew without bound. Now scheduled every 6h.
Also replaces the full-history downloads on the Groups and Suppliers
pages, which fetched every order and delivery with nested relations only
to count rows, with aggregate endpoints that count in the database.
Indexes are created via scripts/auto-migrate-production.sh, the script
that actually runs at deploy time, using CREATE INDEX CONCURRENTLY so no
write lock is taken. Note that server/migrations.ts explicitly ignores
the migrations/ directory and runs only hardcoded migrations; the SQL
file added there is for reference and manual application.
Verified: typecheck baseline 440 errors, 430 after, none new in the
changed code; vite build passes; server boots; functional test confirms
the aggregate endpoints match the source data including the delivered
count.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com >
2026-08-14 11:55:49 +02:00
Michael and Claude Sonnet 4.6
693d9460cb
feat(contacts): add company field to free contacts
...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-05-15 11:29:56 +02:00
Michael and Claude Sonnet 4.6
a430aa1910
feat(contacts): allow admin/directeur to edit supplier coordinates from contacts page
...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-05-15 11:27:33 +02:00
Michael and Claude Sonnet 4.6
b8ecacee3b
merge(main): resolve conflicts keeping codefou + email on suppliers
...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-05-15 11:14:35 +02:00
Michael and Claude Sonnet 4.6
805664dc32
feat(contacts): add contacts page with per-store management and supplier email field
...
- New contacts table (group_id, name, role, phone, email, notes) per store
- Suppliers table: add email field with form and card display
- Page /contacts: two-column layout (suppliers read-only / free contacts CRUD)
- Permissions: read all roles, create/edit/delete admin + directeur + manager
- Admin can filter contacts by store; other roles see their own stores only
- Migration SQL: 20260515_add_contacts_and_supplier_email.sql
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-05-15 10:44:39 +02:00
Michael
0255dc4aba
feat: add BAP file upload functionality to sidebar with processing status modal
2026-04-02 14:58:17 +02:00
Michael
71625031df
feat: add WebhookBAPConfig page for managing and testing n8n webhook settings
2026-04-02 14:52:51 +02:00
Michael
8aa5dd1c83
feat: add mobile-optimized customer orders page with creation form and article lookup integration
2026-04-02 14:25:08 +02:00
Michael
7e2eed93df
feat: add CustomerOrderForm component with automated product lookup and validation
2026-04-02 14:01:31 +02:00
Michael
95a5a2facc
feat: add CustomerOrderForm component with automated product lookup and supplier matching
2026-04-02 13:54:29 +02:00
Michael
22897ede48
feat: add CustomerOrderForm component with automated product lookup and supplier matching
2026-04-02 13:37:16 +02:00
Michael
cf57cb5b2d
feat: add CustomerOrders page with CRUD operations, status management, and client contact tracking
2026-04-02 12:58:56 +02:00
Michael
55191c511b
feat: implement BAP webhook configuration management and customer order tracking support
2026-04-02 12:52:20 +02:00
Michael
576db2d7f4
feat: implement customer order form with automated product lookup and mobile-responsive order page
2026-04-02 11:50:46 +02:00
Michael
6df51a3934
feat: add CustomerOrderForm component with automated article lookup and supplier matching
2026-04-02 11:40:50 +02:00
Michael
58dde2f785
feat: implement CustomerOrderForm component with automated product lookup and create mobile-responsive customer orders page
2026-04-02 11:36:02 +02:00
Michael
a91027c10b
feat: implement DLC tracking page with EAN lookup and CRUD operations for product expiration management
2026-04-02 09:46:59 +02:00
Michael
44950d2239
feat: implement supplier management module with CRUD operations and optimistic updates
2026-04-02 09:38:30 +02:00
Michael
1488accbdb
feat: implement mobile-optimized DLC management page with EAN lookup and status-based filtering
2026-04-02 09:28:46 +02:00
Michael
475c52cede
feat: implement dashboard page with store-specific stats, announcement modals, and DLC alerts
2026-04-02 09:25:09 +02:00
Michael
b090c8f36a
feat: implement DLC management page with EAN lookup, filtering, and CRUD operations
2026-04-02 09:20:54 +02:00
Michael
fcf8518684
feat: implement RouterProduction component to handle environment-aware desktop and mobile routing
2026-04-02 09:00:00 +02:00
Michael
4318bb3b5c
feat: implement production router with mobile/desktop support and add sidebar navigation component
2026-04-02 08:54:39 +02:00
LogiFlow
ea8aed7e01
Merge pull request #560 from R0m1k3/1.1
...
1.1
2026-02-10 09:44:46 +01:00
Michael
cb1a1a933c
fix(dlc): filter stockEpuise products from DLC stats and invalidate stats cache
2026-02-10 09:37:02 +01:00
LogiFlow
5d07344051
Merge pull request #552 from R0m1k3/1.1
...
1.1
2026-01-12 14:13:59 +01:00
Michael
78adc2c5ae
feat(BAP): remplacer destinataire Celia par Jeremy
2026-01-12 14:13:21 +01:00
Michael
8772e7e0b2
feat(BAP): remplacer destinataire Celia par Jeremy
2026-01-12 14:09:25 +01:00
LogiFlow
897985eece
Merge pull request #551 from R0m1k3/1.1
...
feat: Implement new dashboard, publicity management, and calendar pag…
2026-01-06 11:40:16 +01:00
Michael
78b53f576b
feat: Implement new dashboard, publicity management, and calendar pages with corresponding server routes.
2026-01-06 11:39:28 +01:00
LogiFlow
cfb9498a4f
Merge pull request #550 from R0m1k3/1.1
...
feat: add Publicities page with comprehensive management functionalit…
2026-01-05 17:32:34 +01:00
Michael
eb3fb119ee
feat: add Publicities page with comprehensive management functionalities including list/calendar views and CRUD operations.
2026-01-05 17:10:10 +01:00
LogiFlow
4070172cbc
Merge pull request #549 from R0m1k3/1.1
...
publicité
2026-01-05 13:51:16 +01:00
Michael
18c51959af
publicité
2026-01-05 13:50:50 +01:00
LogiFlow
ff3a24ecca
Merge pull request #548 from R0m1k3/1.1
...
feat: add mobile customer orders page with creation and management fu…
2025-12-10 16:55:29 +01:00
Michael
5ab5b32ca5
feat: add mobile customer orders page with creation and management functionality
2025-12-10 16:55:03 +01:00
LogiFlow
540698a0da
Merge pull request #547 from R0m1k3/1.1
...
feat: implement mobile credit notes management page with CRUD operati…
2025-12-10 16:48:57 +01:00
Michael
e626659915
feat: implement mobile credit notes management page with CRUD operations and filtering.
2025-12-10 16:48:21 +01:00
LogiFlow
b31ad6ee96
Merge pull request #546 from R0m1k3/1.1
...
1.1
2025-12-10 16:32:22 +01:00
Michael
77bbeed9c0
feat: add mobile page for managing credit notes (Avoirs) with search, filter, and CRUD functionalities
2025-12-10 16:31:58 +01:00
Michael
4a25c2040b
feat: add mobile customer orders page with order creation and status update functionality
2025-12-10 16:12:57 +01:00
LogiFlow
786b139c37
Merge pull request #545 from R0m1k3/1.1
...
feat: add mobile pages for SAV, customer orders, credit notes, and DL…
2025-12-10 16:06:24 +01:00
Michael
676d8cee96
feat: add mobile pages for SAV, customer orders, credit notes, and DLC, along with a production router.
2025-12-10 16:04:01 +01:00
LogiFlow
f03682baa9
Merge pull request #544 from R0m1k3/1.1
...
feat: add mobile pages for customer orders, publicities, and calendar…
2025-12-10 15:42:14 +01:00
Michael
75be8e75b3
feat: add mobile pages for customer orders, publicities, and calendar, and introduce a production router component.
2025-12-10 15:41:47 +01:00
LogiFlow
189f11319b
Merge pull request #543 from R0m1k3/1.1
...
feat: add mobile calendar page to display orders and deliveries
2025-12-10 15:29:53 +01:00
Michael
a7c3b2913e
feat: add mobile calendar page to display orders and deliveries
2025-12-10 15:11:43 +01:00
LogiFlow
98e8c3f855
Merge pull request #542 from R0m1k3/1.1
...
feat: Implement a mobile calendar page to display orders and deliveri…
2025-12-10 14:59:03 +01:00
Michael
6f94d96420
feat: Implement a mobile calendar page to display orders and deliveries as events.
2025-12-10 14:58:19 +01:00
LogiFlow
64df64c0be
Merge pull request #541 from R0m1k3/1.1
...
feat: add mobile calendar page to display orders and deliveries
2025-12-10 14:51:45 +01:00