whisper-money/database/factories
Víctor Falcón 46c5b13739 feat: Implement drip email campaign system (#35)
## Summary

- Implement event-driven drip email campaign system for new user signups
- Add 5 targeted emails based on user journey (welcome, onboarding
reminder, promo code, import help, feedback)
- Configure Laravel Horizon with Redis queue for reliable job processing
- Track sent emails in `user_mail_logs` table to prevent duplicates

## Email Schedule

| Email | Timing | Condition |
|-------|--------|-----------|
| Welcome | 30 min after signup | All users |
| Onboarding Reminder | 1 day after signup | Not onboarded |
| Promo Code (FOUNDER) | 1 day after signup | Onboarded + has
transactions + not subscribed |
| Import Help | 1 day after signup | Onboarded + no transactions + not
subscribed |
| Feedback | 5 days after signup | Not subscribed |

## Architecture

```
User Registers → ScheduleDripEmailsListener
    ├─> SendWelcomeEmailJob (30 min delay)
    ├─> SendOnboardingReminderEmailJob (1 day delay)
    ├─> SendPromoCodeEmailJob (1 day delay)
    ├─> SendImportHelpEmailJob (1 day delay)
    └─> SendFeedbackEmailJob (5 days delay)
```

Each job checks conditions at execution time and either sends the email
+ logs it, or silently completes.

## Test plan

- [x] All 23 drip email tests pass
- [x] Migration creates `user_mail_logs` table
- [x] Jobs dispatch with correct delays
- [x] Emails only sent when conditions are met
- [x] Duplicate emails prevented via UserMailLog check
- [ ] Verify Horizon processes jobs in production
2025-12-30 07:22:18 +01:00
..
AccountBalanceFactory.php Add account balances 2025-11-15 20:27:18 +01:00
AccountFactory.php feat: Add financial models and seeders 2025-11-07 15:45:28 +00:00
AutomationRuleFactory.php Automation rules 2025-11-10 12:08:58 +00:00
BankFactory.php Update bank model 2025-11-07 19:11:00 +00:00
CategoryFactory.php Add category type field support (#2) 2025-12-01 20:19:47 +01:00
LabelFactory.php feat: add transaction labels feature (#24) 2025-12-13 13:02:19 +01:00
TransactionFactory.php Save transaction source (manually_created, or imported) 2025-11-28 12:36:48 +01:00
UserFactory.php User Onboarding Flow (#23) 2025-12-12 13:06:08 +01:00
UserLeadFactory.php Merge pull request #1 from whisper-money/landing-page 2025-11-24 12:11:35 +01:00
UserMailLogFactory.php feat: Implement drip email campaign system (#35) 2025-12-30 07:22:18 +01:00