feat(db): additive prep migration for the henza data import
Purely additive; nothing dropped, renamed or retyped. Owner rulings of 2026-10-06/07, recorded in docs/DATA-MIGRATION-MAP.md. - Customer.nationalCode is now optional. All 1,595 live legacy customers have none, and fabricating one is a data violation. Still @unique: NULLs do not collide in Postgres, so the import must write NULL, not ''. - Customer.birthDate added, empty. Must not be backfilled until the Jalali-vs-Gregorian check (precheck-3) is in. - VerificationStep.REJECTED plus verificationRejectionReason/RejectedAt. Legacy has a third "rejected" state that the enum could not represent. - CustomerFavorite for legacy `fav` (251 rows), which had no home. accounting-sync customerPayload() now takes `nationalCode: string | null`. validNationalCode() already handled null, so Tahesab/Zarrin receive exactly what they did before. Caught by tsc after the column change. Not touched: accounting* columns, ProductVariant.imageId, the Accounting* tables, SMS (PROTECTED.md §B, §G). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
19d490e790
commit
45633b5aa0
@@ -230,7 +230,11 @@ export class AccountingSyncService {
|
||||
}
|
||||
|
||||
private customerPayload(
|
||||
c: { firstName: string | null; lastName: string | null; fullName: string; mobile: string; phone: string | null; address: string | null; nationalCode: string },
|
||||
// nationalCode is nullable since 2026-10-07 (no legacy customer has one —
|
||||
// docs/DATA-MIGRATION-MAP.md §10.4). validNationalCode() already takes
|
||||
// `string | null` and maps empty/invalid to null, so the providers below
|
||||
// keep receiving exactly what they received before.
|
||||
c: { firstName: string | null; lastName: string | null; fullName: string; mobile: string; phone: string | null; address: string | null; nationalCode: string | null },
|
||||
group: ExternalGroup | null,
|
||||
): CustomerPayload {
|
||||
const parts = c.firstName || c.lastName ? { firstName: c.firstName ?? '', lastName: c.lastName ?? '' } : splitName(c.fullName);
|
||||
|
||||
Reference in New Issue
Block a user