Add models, enums, and services for user roles, theme preferences, slug history, and ID generation

This commit is contained in:
pacnpal
2025-02-23 19:50:40 -05:00
parent 32aea21e48
commit 7e5d15eb46
55 changed files with 6462 additions and 4 deletions

View File

@@ -0,0 +1,82 @@
# Operator Model Conversion
## Original Django Model Structure
### Company Model (Now Operator)
```python
class Company(TrackedModel):
name = models.CharField(max_length=255)
slug = models.SlugField(max_length=255, unique=True)
website = models.URLField(blank=True)
headquarters = models.CharField(max_length=255, blank=True)
description = models.TextField(blank=True)
total_parks = models.IntegerField(default=0)
total_rides = models.IntegerField(default=0)
```
### Manufacturer Model
```python
class Manufacturer(TrackedModel):
name = models.CharField(max_length=255)
slug = models.SlugField(max_length=255, unique=True)
website = models.URLField(blank=True)
headquarters = models.CharField(max_length=255, blank=True)
description = models.TextField(blank=True)
total_rides = models.IntegerField(default=0)
total_roller_coasters = models.IntegerField(default=0)
```
## Laravel Implementation Plan
### Database Migrations
1. Create operators table:
```php
Schema::create('operators', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('slug')->unique();
$table->string('website')->nullable();
$table->string('headquarters')->nullable();
$table->text('description')->nullable();
$table->integer('total_parks')->default(0);
$table->integer('total_rides')->default(0);
$table->timestamps();
});
```
2. Create manufacturers table:
```php
Schema::create('manufacturers', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('slug')->unique();
$table->string('website')->nullable();
$table->string('headquarters')->nullable();
$table->text('description')->nullable();
$table->integer('total_rides')->default(0);
$table->integer('total_roller_coasters')->default(0);
$table->timestamps();
});
```
### Models
1. Operator Model:
- Implement Sluggable trait
- Add relationships (parks)
- Add statistics updating methods
- Add slug history functionality
2. Manufacturer Model:
- Implement Sluggable trait
- Add relationships (rides)
- Add statistics updating methods
- Add slug history functionality
### Next Steps
1. [ ] Create operators table migration
2. [ ] Create manufacturers table migration
3. [ ] Create Operator model
4. [ ] Create Manufacturer model
5. [ ] Implement statistics update methods