Skip to content

fix(customers): preserve canonical identity and correct invalid-phone filters #257

Description

@khaira777

Summary

Customer reactivation and invalid-phone filtering need canonical, data-preserving behavior.

Current behavior

  • main/routes/customers.ts:217-248 searches only canonical phone_digits, so raw legacy rows can be missed and duplicated.
  • The soft-reactivation UPDATE does not write the canonical phone field.
  • main/routes/customers.ts:48-54,112-114 uses an unparenthesized AND/OR invalid-phone predicate.
  • tests/customer-soft-reactivate-bindings.test.ts currently fails 5 assertions; its raw legacy fixture and contradictory country-code expectation also need correction.

Expected behavior

Equivalent customer records should reactivate without duplicate IDs, canonical phone fields should be updated consistently, and invalid-phone filters should apply exactly to the intended active rows.

Acceptance criteria

  • Define lookup behavior for canonical and legacy national phone forms.
  • Preserve the customer ID while updating phone, country code, name, email, address, notes, and active state atomically.
  • Parenthesize and test the invalid-phone predicate for active/inactive valid/invalid combinations.
  • Correct the regression fixture and add separate canonical and legacy cases.

Relevant files

main/routes/customers.ts, tests/customer-soft-reactivate-bindings.test.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:backendBackend (Express/SQLite)bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions