libra/docs/stories/story-8.6-consultation-remi...

1.6 KiB

Story 8.6: Consultation Reminder (24 Hours)

Epic Reference

Epic 8: Email Notification System

User Story

As a client, I want to receive a reminder 24 hours before my consultation, So that I don't forget my appointment.

Acceptance Criteria

Trigger

  • Scheduled job runs daily
  • Find consultations 24 hours away
  • Only for approved consultations
  • Skip cancelled/no-show

Content

  • "Reminder: Your consultation is tomorrow"
  • Date and time
  • Consultation type
  • Payment reminder (if paid and not received)
  • Calendar file link
  • Any preparation notes

Language

  • Email in client's preferred language

Technical Notes

// Command: php artisan reminders:send-24h
class Send24HourReminders extends Command
{
    public function handle(): int
    {
        $targetTime = now()->addHours(24);

        Consultation::where('status', 'approved')
            ->whereNull('reminder_24h_sent_at')
            ->whereDate('scheduled_date', $targetTime->toDateString())
            ->each(function ($consultation) {
                $consultation->user->notify(new ConsultationReminder24h($consultation));
                $consultation->update(['reminder_24h_sent_at' => now()]);
            });

        return Command::SUCCESS;
    }
}

// Schedule: hourly

Definition of Done

  • Command runs successfully
  • Reminders sent to correct consultations
  • Payment reminder for unpaid
  • No duplicate reminders
  • Bilingual templates
  • Tests pass

Estimation

Complexity: Medium | Effort: 3 hours