Adding registration date and multiple addresses for contacts and leads.
This commit is contained in:
@@ -12,3 +12,23 @@ export function toJsonCustomFields(
|
||||
): Prisma.InputJsonValue {
|
||||
return (value ?? {}) as Prisma.InputJsonValue;
|
||||
}
|
||||
|
||||
export function asAddresses(value: unknown): string[] {
|
||||
if (!Array.isArray(value)) return [];
|
||||
const out: string[] = [];
|
||||
for (const item of value) {
|
||||
const text = String(item ?? '').trim();
|
||||
if (text && !out.includes(text)) out.push(text);
|
||||
if (out.length >= 20) break;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
export function toJsonAddresses(value?: string[] | null): Prisma.InputJsonValue {
|
||||
return asAddresses(value ?? []);
|
||||
}
|
||||
|
||||
/** Collect address-like cells from an excel row into a unique list. */
|
||||
export function collectAddresses(...parts: Array<string | undefined | null>): string[] {
|
||||
return asAddresses(parts.map((p) => (p ?? '').trim()).filter(Boolean));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user