fix(loyalty): admin/store/merchant card detail return phone + birthday
The shared card-detail-view template already renders card.customer_phone and card.customer_birthday, but CardDetailResponse was missing both fields, so every consumer (admin, store, merchant) silently returned them as undefined and the UI showed "-". Added the two fields to the schema and populated them from customer.phone / customer.birth_date in all three endpoints. Data was persisting correctly all along — purely a serialization gap. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -381,6 +381,8 @@ def get_merchant_card(
|
||||
enrolled_at_store_id=card.enrolled_at_store_id,
|
||||
customer_name=customer.full_name if customer else None,
|
||||
customer_email=customer.email if customer else None,
|
||||
customer_phone=customer.phone if customer else None,
|
||||
customer_birthday=customer.birth_date if customer else None,
|
||||
merchant_name=card.merchant.name if card.merchant else None,
|
||||
qr_code_data=card.qr_code_data or card.card_number,
|
||||
program_name=program.display_name,
|
||||
|
||||
@@ -228,6 +228,8 @@ def get_card_detail(
|
||||
enrolled_at_store_id=card.enrolled_at_store_id,
|
||||
customer_name=customer.full_name if customer else None,
|
||||
customer_email=customer.email if customer else None,
|
||||
customer_phone=customer.phone if customer else None,
|
||||
customer_birthday=customer.birth_date if customer else None,
|
||||
merchant_name=card.merchant.name if card.merchant else None,
|
||||
qr_code_data=card.qr_code_data or card.card_number,
|
||||
program_name=program.display_name,
|
||||
|
||||
@@ -656,6 +656,8 @@ def get_card_detail(
|
||||
enrolled_at_store_name=enrolled_store_name,
|
||||
customer_name=customer.full_name if customer else None,
|
||||
customer_email=customer.email if customer else None,
|
||||
customer_phone=customer.phone if customer else None,
|
||||
customer_birthday=customer.birth_date if customer else None,
|
||||
merchant_name=card.merchant.name if card.merchant else None,
|
||||
qr_code_data=card.qr_code_data or card.card_number,
|
||||
program_name=program.display_name,
|
||||
|
||||
@@ -97,6 +97,8 @@ class CardDetailResponse(CardResponse):
|
||||
# Customer info
|
||||
customer_name: str | None = None
|
||||
customer_email: str | None = None
|
||||
customer_phone: str | None = None
|
||||
customer_birthday: date | None = None
|
||||
|
||||
# Merchant info
|
||||
merchant_name: str | None = None
|
||||
|
||||
Reference in New Issue
Block a user