Files
libra/docs/tasks/11-1.md
T
Naser Mansour 0f9d12c3cf Prepare project for pipeline takeover: task tracker, UX doc, CLAUDE.md pointers
Adds docs/tasks/ (16 epics + 102 stories converted to task/subtask files with
statuses.md as the new status source of truth) and docs/ux-design.md
(retrospective design-system reference), and points CLAUDE.md at them.
docs/prd.md and docs/architecture.md are kept as BMAD wrote them; the legacy
docs/stories/, docs/epics/, docs/qa/gates/ and .bmad-core/ stay in place as
historical/traceability records, superseded but not deleted.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-27 22:02:23 +03:00

1.6 KiB

id, title, status, date, parent
id title status date parent
11-1 11-1 Database Schema & Model Updates QA Review 2026-09-27 11

Description

As a developer, I want to extend the consultation system to support guest bookings, So that consultations can be created for both registered clients and anonymous guests. The existing foreign key consultations_user_id_foreign cascades on delete. With nullable user_id: - Guest consultations won't be affected by user deletions (they have no user) - Client consultations still cascade delete when user is deleted. Full implementation history: docs/stories/story-11.1-database-schema-model-updates.md

Acceptance Criteria

  • user_id column changed to nullable on consultations table
  • guest_name column added (varchar 255, nullable)
  • guest_email column added (varchar 255, nullable)
  • guest_phone column added (varchar 50, nullable)
  • Index added on guest_email for 1-per-day lookup performance
  • Migration is reversible without data loss
  • Existing consultations with user_id unaffected
  • Consultation model updated with new fillable fields
  • isGuest() helper method returns true when user_id is null
  • getClientName() helper returns guest_name or user->full_name
  • getClientEmail() helper returns guest_email or user->email
  • getClientPhone() helper returns guest_phone or user->phone
  • Model validation ensures either user_id OR guest fields are present
  • ConsultationFactory updated with guest() state
  • Guest state generates fake guest_name, guest_email, guest_phone
  • Guest state sets user_id to null