Просмотр исходного кода

Added ability to match column names with numbers in them.

vtugulan 3 дней назад
Родитель
Сommit
776d866a0e
1 измененных файлов с 1 добавлено и 3 удалено
  1. 1 3
      app/lib/excel-import/bulk-inserter.ts

+ 1 - 3
app/lib/excel-import/bulk-inserter.ts

@@ -35,15 +35,13 @@ export class BulkInserter {
           // Map the row data to match Prisma model field names
           // Map the row data to match Prisma model field names
           Object.keys(row).forEach(key => {
           Object.keys(row).forEach(key => {
             // Convert snake_case to camelCase for Prisma model compatibility
             // Convert snake_case to camelCase for Prisma model compatibility
-            const camelKey = key.replace(/_([a-z])/g, (g) => g[1].toUpperCase());
+            const camelKey = key.replace(/_([a-z0-9])/g, (g) => g[1].toUpperCase());
             mappedRow[camelKey] = row[key];
             mappedRow[camelKey] = row[key];
           });
           });
 
 
           return mappedRow;
           return mappedRow;
         });
         });
 
 
-        console.log(batch)
-        console.log(values);
         // Use appropriate Prisma model based on table name
         // Use appropriate Prisma model based on table name
         if (tableName === 'cintas_install_calendar') {
         if (tableName === 'cintas_install_calendar') {
           await this.prisma.cintasInstallCalendar.createMany({
           await this.prisma.cintasInstallCalendar.createMany({