send from gmail
This commit is contained in:
@ -8,7 +8,7 @@ import { Customer } from '../lib/database/entities/Customer';
|
||||
interface CustomerCSVRow {
|
||||
City: string;
|
||||
Name: string;
|
||||
'Website URL': string;
|
||||
URL: string;
|
||||
Email: string;
|
||||
}
|
||||
|
||||
@ -66,14 +66,20 @@ async function importCustomers(csvFilePath: string): Promise<void> {
|
||||
// Create new customer
|
||||
const customer = new Customer();
|
||||
customer.name = name;
|
||||
customer.url = record['Website URL'] === 'null' ? '' : record['Website URL'];
|
||||
customer.url = record['URL'] === 'null' ? '' : record['URL'];
|
||||
customer.email = email;
|
||||
|
||||
// Save to database
|
||||
await customerRepository.save(customer);
|
||||
importedCount++;
|
||||
try {
|
||||
|
||||
// Save to database
|
||||
await customerRepository.save(customer);
|
||||
importedCount++;
|
||||
|
||||
console.log(`Imported customer: ${name}`);
|
||||
} catch (e) {
|
||||
console.log(`Skipped: ${name}`);
|
||||
}
|
||||
|
||||
console.log(`Imported customer: ${name}`);
|
||||
}
|
||||
|
||||
console.log('Import summary:');
|
||||
|
||||
Reference in New Issue
Block a user