mirror of
https://github.com/pacnpal/thrillwiki_laravel.git
synced 2025-12-20 06:31:10 -05:00
feat: Implement rides management with CRUD functionality
- Added rides index view with search and filter options. - Created rides show view to display ride details. - Implemented API routes for rides. - Developed authentication routes for user registration, login, and email verification. - Created tests for authentication, email verification, password reset, and user profile management. - Added feature tests for rides and operators, including creation, updating, deletion, and searching. - Implemented soft deletes and caching for rides and operators. - Enhanced manufacturer and operator model tests for various functionalities.
This commit is contained in:
177
manufacturer-implementation-prompt.md
Normal file
177
manufacturer-implementation-prompt.md
Normal file
@@ -0,0 +1,177 @@
|
||||
# 🏭 ThrillWiki Manufacturer Model & System Implementation
|
||||
|
||||
**PRIORITY 1: Create Manufacturer Model & System - Production-Ready Implementation**
|
||||
|
||||
## 🎯 **MISSION: CRITICAL ENTITY ARCHITECTURE IMPLEMENTATION**
|
||||
|
||||
You are implementing the **Manufacturer entity** for ThrillWiki - a critical architectural component that represents ride building companies (Intamin, B&M, Vekoma) and establishes proper entity separation from theme park Operators.
|
||||
|
||||
## 🏗️ **ARCHITECTURAL CONTEXT**
|
||||
|
||||
### **CRITICAL ENTITY SEPARATION ACHIEVED**
|
||||
This implementation resolves a major architectural conflict where "Operator" was incorrectly handling both park ownership AND ride manufacturing responsibilities.
|
||||
|
||||
**CORRECTED ARCHITECTURE**:
|
||||
- ✅ **Operator**: Theme park companies (Disney, Six Flags) - manages `parks()` only
|
||||
- ✅ **Manufacturer**: Ride building companies (Intamin, B&M) - has `rides()` as manufacturer
|
||||
- ✅ **Designer**: Individual designers (Werner Stengel) - has `rides()` as designer
|
||||
|
||||
## 📊 **DATABASE FOUNDATION - ALREADY EXISTS**
|
||||
|
||||
**Migration**: `database/migrations/2024_02_23_234948_create_operators_and_manufacturers_tables.php`
|
||||
**Status**: ✅ **Table exists** - Focus on model implementation and relationships
|
||||
|
||||
**Key Fields**:
|
||||
- `id`, `name`, `slug`, `website`, `headquarters`, `description`
|
||||
- `total_rides`, `total_roller_coasters` (cached statistics)
|
||||
- `is_active`, `created_at`, `updated_at`, `deleted_at`
|
||||
- **Indexes**: PRIMARY(`id`), UNIQUE(`slug`), INDEX(`is_active`, `total_rides`, `deleted_at`)
|
||||
|
||||
## 🚀 **IMPLEMENTATION COMMAND**
|
||||
|
||||
```bash
|
||||
php artisan make:thrillwiki-model Manufacturer --migration --factory --with-relationships --cached --api-resource --with-tests
|
||||
```
|
||||
|
||||
**Expected Results**: Model with HasSlugHistory trait, proper relationships, factory, tests, API resource
|
||||
|
||||
## 🔧 **REQUIRED MODEL SPECIFICATIONS**
|
||||
|
||||
### **Traits Integration**
|
||||
- ✅ **HasFactory**: Laravel factory integration
|
||||
- ✅ **HasSlugHistory**: ThrillWiki slug management (CRITICAL for proper entity behavior)
|
||||
- ✅ **SoftDeletes**: Standard soft delete functionality
|
||||
|
||||
### **Key Relationships**
|
||||
```php
|
||||
// PRIMARY RELATIONSHIP - Rides manufactured by this company
|
||||
public function rides(): HasMany
|
||||
{
|
||||
return $this->hasMany(Ride::class, 'manufacturer_id');
|
||||
}
|
||||
```
|
||||
|
||||
### **Business Logic Methods**
|
||||
```php
|
||||
// Statistics updates for performance optimization
|
||||
public function updateStatistics(): void
|
||||
|
||||
// Display helpers
|
||||
public function getDisplayNameAttribute(): string
|
||||
public function getWebsiteUrlAttribute(): string
|
||||
```
|
||||
|
||||
### **Query Scopes**
|
||||
```php
|
||||
// Major manufacturers filter
|
||||
public function scopeMajorManufacturers($query, int $minRides = 5)
|
||||
|
||||
// Coaster manufacturers filter
|
||||
public function scopeCoasterManufacturers($query)
|
||||
```
|
||||
|
||||
### **Route Model Binding**
|
||||
```php
|
||||
public function getRouteKeyName(): string
|
||||
{
|
||||
return 'slug'; // Use slug for URL routing
|
||||
}
|
||||
```
|
||||
|
||||
## ⚡ **CRITICAL SUCCESS FACTORS**
|
||||
|
||||
### **98% Development Speed Achievement**
|
||||
- **Custom Generator**: Leverages ThrillWiki's proven acceleration framework
|
||||
- **Time Savings**: 1-4 seconds vs 30-45 minutes manual implementation
|
||||
- **Pattern Compliance**: Automatic ThrillWiki standard integration
|
||||
|
||||
### **Django Parity Verification**
|
||||
- **Architecture Match**: Aligns with original Django implementation structure
|
||||
- **Field Compatibility**: Maintains identical data structures
|
||||
- **Business Logic**: Preserves original functionality patterns
|
||||
|
||||
### **Performance Optimization Built-In**
|
||||
- **Caching Integration**: Automatic statistics caching (`total_rides`, `total_roller_coasters`)
|
||||
- **Query Optimization**: Pre-built scopes for common queries
|
||||
- **Database Indexes**: Optimized for filtering and search operations
|
||||
|
||||
## 🧪 **TESTING REQUIREMENTS**
|
||||
|
||||
### **Generated Test Coverage**
|
||||
- ✅ **Model Tests**: Factory creation, relationships, business logic
|
||||
- ✅ **Relationship Tests**: Proper manufacturer-ride associations
|
||||
- ✅ **Scope Tests**: Query scope functionality verification
|
||||
- ✅ **Statistics Tests**: Cache update functionality
|
||||
|
||||
### **Validation Tests**
|
||||
```php
|
||||
// Test proper entity separation
|
||||
$manufacturer = Manufacturer::factory()->create();
|
||||
$ride = Ride::factory()->create(['manufacturer_id' => $manufacturer->id]);
|
||||
$this->assertEquals($manufacturer->id, $ride->manufacturer->id);
|
||||
|
||||
// Test statistics functionality
|
||||
$manufacturer->updateStatistics();
|
||||
$this->assertEquals(1, $manufacturer->total_rides);
|
||||
```
|
||||
|
||||
## 🎯 **IMPLEMENTATION VERIFICATION**
|
||||
|
||||
### **Post-Generation Checklist**
|
||||
1. ✅ **Model Generated**: `app/Models/Manufacturer.php` with proper traits
|
||||
2. ✅ **Factory Created**: `database/factories/ManufacturerFactory.php`
|
||||
3. ✅ **Tests Generated**: `tests/Feature/ManufacturerTest.php`
|
||||
4. ✅ **API Resource**: `app/Http/Resources/ManufacturerResource.php`
|
||||
5. ✅ **Relationships**: Proper `rides()` hasMany relationship
|
||||
|
||||
### **Architecture Validation**
|
||||
```php
|
||||
// Verify entity separation works correctly
|
||||
$intamin = Manufacturer::create(['name' => 'Intamin AG', 'slug' => 'intamin']);
|
||||
$ride = Ride::create([
|
||||
'name' => 'Millennium Force',
|
||||
'manufacturer_id' => $intamin->id, // CORRECT: Manufacturer builds rides
|
||||
'park_id' => $park->id
|
||||
]);
|
||||
|
||||
$operator = Operator::create(['name' => 'Cedar Fair', 'slug' => 'cedar-fair']);
|
||||
$park = Park::create([
|
||||
'name' => 'Cedar Point',
|
||||
'operator_id' => $operator->id // CORRECT: Operator owns parks
|
||||
]);
|
||||
```
|
||||
|
||||
## 📚 **DOCUMENTATION UPDATE REQUIREMENTS**
|
||||
|
||||
### **Memory Bank Updates**
|
||||
- ✅ Update `progress.md` with implementation completion
|
||||
- ✅ Update `activeContext.md` with next steps
|
||||
- ✅ Document any generator customizations needed
|
||||
|
||||
### **Entity Documentation**
|
||||
- ✅ Complete manufacturer relationship documentation
|
||||
- ✅ Update ride model relationship references
|
||||
- ✅ Verify operator entity scope clarification
|
||||
|
||||
## 🏆 **SUCCESS METRICS**
|
||||
|
||||
### **Performance Targets**
|
||||
- **Generation Time**: < 5 seconds total execution
|
||||
- **Test Coverage**: 100% model functionality
|
||||
- **Memory Usage**: Optimized for high-volume manufacturer queries
|
||||
|
||||
### **Quality Assurance**
|
||||
- **Code Standards**: PSR-12 compliant generated code
|
||||
- **Laravel Conventions**: Proper Eloquent model patterns
|
||||
- **ThrillWiki Patterns**: Consistent with project architecture
|
||||
|
||||
## 🚀 **EXECUTION COMMAND**
|
||||
|
||||
**READY TO EXECUTE**:
|
||||
```bash
|
||||
php artisan make:thrillwiki-model Manufacturer --migration --factory --with-relationships --cached --api-resource --with-tests
|
||||
```
|
||||
|
||||
**Expected Outcome**: Complete, production-ready Manufacturer entity with proper architecture separation, performance optimization, comprehensive testing, and Django parity compliance.
|
||||
|
||||
**Next Steps After Success**: Proceed to CRUD system generation and Ride model relationship updates.
|
||||
Reference in New Issue
Block a user