send from gmail

This commit is contained in:
Ken Yasue
2025-04-01 16:19:00 +02:00
parent 45164faa9d
commit 597f7ddc55
6 changed files with 129 additions and 10 deletions

View File

@ -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:');