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:
2026-10-04 12:01:21 +03:30
co-authored by Cursor
parent e144b2277a
commit 8b37525f2f
15 changed files with 632 additions and 25 deletions
@@ -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;