From ce6760a2eaa77ac1da9209c6189ba94c5f8b6390 Mon Sep 17 00:00:00 2001 From: Manus Date: Fri, 5 Jun 2026 08:26:31 -0400 Subject: [PATCH] fix: insertion freeproVentilationLines par lots de 50 pour eviter limite MySQL --- .manus/db/db-query-1780662192829.json | 28 +++++++++++++++++++++++++++ .manus/db/db-query-1780662202220.json | 9 +++++++++ server/db.ts | 10 +++++++--- todo.md | 2 +- 4 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 .manus/db/db-query-1780662192829.json create mode 100644 .manus/db/db-query-1780662202220.json diff --git a/.manus/db/db-query-1780662192829.json b/.manus/db/db-query-1780662192829.json new file mode 100644 index 0000000..45985d0 --- /dev/null +++ b/.manus/db/db-query-1780662192829.json @@ -0,0 +1,28 @@ +{ + "query": "SELECT id, email, name, role, isActive, loginMethod, passwordHash IS NOT NULL as hasPassword FROM users WHERE role = 'admin' OR email LIKE '%pareige%' OR email LIKE '%admin%';", + "command": "mysql --batch --raw --column-names --default-character-set=utf8mb4 --host gateway02.us-east-1.prod.aws.tidbcloud.com --port 4000 --user 4CrrYuB5tme73Qo.bd4328423008 --database fo4DRyBgjsuiigFAgNLuWm --execute SELECT id, email, name, role, isActive, loginMethod, passwordHash IS NOT NULL as hasPassword FROM users WHERE role = 'admin' OR email LIKE '%pareige%' OR email LIKE '%admin%';", + "rows": [ + { + "id": "1", + "email": "o.pareige@itinova.org", + "name": "Administrateur", + "role": "admin", + "isActive": "1", + "loginMethod": "local", + "hasPassword": "1" + }, + { + "id": "30001", + "email": "adminItinova", + "name": "Administrateur Itinova", + "role": "admin", + "isActive": "1", + "loginMethod": "local", + "hasPassword": "1" + } + ], + "messages": [], + "stdout": "id\temail\tname\trole\tisActive\tloginMethod\thasPassword\n1\to.pareige@itinova.org\tAdministrateur\tadmin\t1\tlocal\t1\n30001\tadminItinova\tAdministrateur Itinova\tadmin\t1\tlocal\t1\n", + "stderr": "", + "execution_time_ms": 428 +} \ No newline at end of file diff --git a/.manus/db/db-query-1780662202220.json b/.manus/db/db-query-1780662202220.json new file mode 100644 index 0000000..525a45b --- /dev/null +++ b/.manus/db/db-query-1780662202220.json @@ -0,0 +1,9 @@ +{ + "query": "UPDATE users SET passwordHash = '$2b$10$9W4GwfiBPW4HOKupaNKFPOrLU76AbgcVk3wV2Rcb4Z9Xw9ORZOdNW', loginMethod = 'local' WHERE email = 'o.pareige@itinova.org';", + "command": "mysql --batch --raw --column-names --default-character-set=utf8mb4 --host gateway02.us-east-1.prod.aws.tidbcloud.com --port 4000 --user 4CrrYuB5tme73Qo.bd4328423008 --database fo4DRyBgjsuiigFAgNLuWm --execute UPDATE users SET passwordHash = '$2b$10$9W4GwfiBPW4HOKupaNKFPOrLU76AbgcVk3wV2Rcb4Z9Xw9ORZOdNW', loginMethod = 'local' WHERE email = 'o.pareige@itinova.org';", + "rows": [], + "messages": [], + "stdout": "", + "stderr": "", + "execution_time_ms": 269 +} \ No newline at end of file diff --git a/server/db.ts b/server/db.ts index 19737ce..14c1003 100644 --- a/server/db.ts +++ b/server/db.ts @@ -966,9 +966,13 @@ export async function createFreeproImport( const result = await db.insert(freeproImports).values(data); const importId = (result as unknown as { insertId: number }).insertId; if (lines.length > 0) { - await db.insert(freeproVentilationLines).values( - lines.map((l) => ({ ...l, importId })) - ); + const mappedLines = lines.map((l) => ({ ...l, importId })); + // Insérer par lots de 50 pour éviter les limites de paramètres MySQL + const BATCH_SIZE = 50; + for (let i = 0; i < mappedLines.length; i += BATCH_SIZE) { + const batch = mappedLines.slice(i, i + BATCH_SIZE); + await db.insert(freeproVentilationLines).values(batch); + } } return importId; } diff --git a/todo.md b/todo.md index 331e149..0779ff9 100644 --- a/todo.md +++ b/todo.md @@ -656,4 +656,4 @@ - [x] Page VentilationFreePro.tsx : import drag&drop, tableau de ventilation, historique, export PDF - [x] Menu "Ventilations > FreePro" ajouté dans DashboardLayout - [x] Route /ventilation-freepro ajoutée dans App.tsx -- [ ] Déploiement sur recette +- [x] Déploiement sur recette (git pull + migrations DB + docker compose up --build)