Files
shanxia2.0/openspec/changes/mobile-qa-quote-contact-sync/specs/mobile-quote-contact-sync/spec.md
T
2026-10-22 16:24:46 +08:00

2.4 KiB

Mobile quote contact integration

ADDED Requirements

Requirement: Mobile updates persist the selected contact name

The mobile quote update entry SHALL resolve the canonical contact name, phone and email snapshot using the authenticated tenant, the quote's effective customer and the submitted contact ID. It SHALL reuse the existing quote update validation, data scope and single-transaction persistence flow. It SHALL NOT trust a client-submitted contact name or snapshot. Empty canonical phone/email values SHALL replace stale values from the previous contact.

Scenario: Change the customer and contact on a draft

  • WHEN the mobile form saves an existing draft with another accessible customer and one of that customer's contacts
  • THEN the saved contact ID and name belong to that selected contact, and subsequent mobile and Web reads show consistent name and phone data.

Scenario: Invalid or inaccessible contact

  • WHEN the requested contact is deleted, belongs to a different customer or tenant, or is outside the user's allowed scope
  • THEN the update is rejected without persisting the quote changes.

Scenario: Clear an optional contact on a draft

  • WHEN the mobile draft explicitly clears its contact
  • THEN the persisted contact ID, name, phone and email are cleared, subject to the existing draft validation rules.

Scenario: Omit the optional contact

  • WHEN the mobile update omits the contact field and retains the same customer
  • THEN the existing contact is retained and its current canonical snapshot is validated and resolved again.
  • WHEN the customer changes and the mobile update omits the contact field
  • THEN the previous customer's contact ID and snapshot are cleared.

Requirement: Existing Web behavior remains unchanged

The original Web update route, request schema, default CRUD behavior and frontend UI SHALL remain unchanged. A server-internal optional canonical snapshot argument MAY extend the existing CRUD transaction; its default SHALL retain original Web behavior. Only the explicit mobile page variant SHALL call the mobile update entry, both when saving a draft and when saving before approval submission.

Scenario: Desktop save

  • WHEN the desktop quote form saves a draft or submits it for approval
  • THEN it continues to use the original route and original request and validation behavior.