Track person import source and previous names; add source report and edit UX.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -22,6 +22,7 @@ import {
|
||||
} from '../common/excel-import-session';
|
||||
import { CompaniesService } from './companies.service';
|
||||
import { PeopleService } from './people.service';
|
||||
import { normalizePersonImportSource } from './person-source';
|
||||
|
||||
type ImportChunkOpts = {
|
||||
sessionId?: string;
|
||||
@@ -459,6 +460,16 @@ export class ContactsExcelService {
|
||||
})();
|
||||
|
||||
try {
|
||||
const didarId = customFields.didarId?.trim() || '';
|
||||
const customerCode = customFields.customerCode?.trim() || '';
|
||||
const sourceCol = customFields.source?.trim() || '';
|
||||
const importSource = didarId
|
||||
? 'didar'
|
||||
: sourceCol
|
||||
? normalizePersonImportSource(sourceCol)
|
||||
: 'excel';
|
||||
const sourceRef = didarId || customerCode || null;
|
||||
|
||||
await this.people.create(actor, {
|
||||
firstName: names.firstName,
|
||||
lastName: names.lastName,
|
||||
@@ -474,6 +485,8 @@ export class ContactsExcelService {
|
||||
companyId,
|
||||
ownerId: resolveOwnerId(actor, ownerId ?? null),
|
||||
customFields,
|
||||
importSource,
|
||||
sourceRef,
|
||||
registeredAt: registeredAt?.toISOString() ?? null,
|
||||
});
|
||||
result.created += 1;
|
||||
|
||||
Reference in New Issue
Block a user