reviewd and fixed epic 1 & 2

This commit is contained in:
Naser Mansour
2025-12-20 21:14:15 +02:00
parent 8f95089814
commit b93b9363a6
9 changed files with 1040 additions and 66 deletions
@@ -49,9 +49,13 @@ So that **the foundation is established for all subsequent feature development**
## Technical Notes
- **Database:** Use SQLite for development (configurable for MariaDB in production)
- **Environment:** Set `DB_CONNECTION=sqlite` in `.env` for development
- **Reference:** PRD Section 16.1 for complete schema details
- **Pattern:** Follow existing Volt class-based component pattern
- **Structure:** Use Laravel 12 streamlined file structure (no app/Http/Middleware, bootstrap/app.php for config)
- **Testing:** Use Pest 4 for all tests (`php artisan make:test --pest`)
- **Models:** Create with `php artisan make:model ModelName -mf` (migration + factory)
- **Notifications table:** Custom implementation per PRD schema (not Laravel's built-in notifications)
### Database Schema Reference
@@ -100,6 +104,40 @@ admin_logs:
- [ ] Code formatted with Pint
- [ ] No errors on fresh install
## Test Scenarios
All tests should use Pest 4 (`php artisan make:test --pest`).
### Migration Tests
- [ ] All migrations run successfully: `php artisan migrate:fresh`
- [ ] Migrations can rollback without errors: `php artisan migrate:rollback`
- [ ] Foreign key constraints are properly created (timeline_updates.timeline_id, timeline_updates.admin_id, consultations.user_id, timelines.user_id, admin_logs.admin_id)
### Factory Tests
- [ ] UserFactory creates valid User with all user_type enum values (admin, individual, company)
- [ ] ConsultationFactory creates valid Consultation with proper user relationship
- [ ] TimelineFactory creates valid Timeline with proper user relationship
- [ ] TimelineUpdateFactory creates valid TimelineUpdate with timeline and admin relationships
- [ ] PostFactory creates valid Post with bilingual fields
- [ ] WorkingHoursFactory creates valid WorkingHours for each day_of_week (0-6)
- [ ] BlockedTimeFactory creates valid BlockedTime entries
- [ ] NotificationFactory creates valid Notification entries
- [ ] AdminLogFactory creates valid AdminLog with JSON fields
### Enum Validation Tests
- [ ] User.user_type only accepts: admin, individual, company
- [ ] User.status only accepts: active, deactivated
- [ ] User.preferred_language only accepts: ar, en
- [ ] Consultation.status only accepts: pending, approved, completed, cancelled, no_show
- [ ] Consultation.type only accepts: free, paid
- [ ] Timeline.status only accepts: active, archived
- [ ] Post.status only accepts: draft, published
### Edge Case Tests
- [ ] Nullable fields accept null values (national_id, company_name, case_reference, etc.)
- [ ] JSON fields (old_values, new_values) store and retrieve correctly
- [ ] Unique constraint on case_reference allows multiple nulls but no duplicate values
## Dependencies
- None (this is the foundation story)
@@ -110,6 +148,12 @@ admin_logs:
- **Mitigation:** Follow PRD specifications closely, validate with stakeholder
- **Rollback:** Fresh migration reset possible in development
### Error Handling
- **Migration failures:** Run `php artisan migrate:status` to identify failed migrations, fix the issue, then `php artisan migrate` to continue
- **Foreign key errors:** Ensure referenced tables are created before dependent tables (migrations run in filename order)
- **Factory errors:** Ensure factories define all required (non-nullable) fields and use valid enum values
## Estimation
**Complexity:** Medium