# Custom Resource Types & Logo Upload - Implementation Plan
## Overview
Allow businesses to create custom resource types (e.g., "Stylist", "Massage Therapist", "Treatment Room") instead of hardcoded types. Also add logo upload to business branding.
## Features
### 1. Custom Resource Types
- **Default Types**: Always include one "Staff" type (cannot be deleted)
- **Custom Names**: Users can name types whatever they want (e.g., "Hair Stylist", "Nail Technician", "Massage Room")
- **Categories**: Each type has a category:
- `STAFF`: Requires staff member assignment
- `OTHER`: No staff assignment needed
- **Management**: Add, edit, delete custom types in Business Settings
### 2. Logo Upload
- Upload business logo in branding section
- Support PNG, JPG, SVG
- Preview before saving
- Used in customer-facing pages
## Database Changes
### Backend Models
```python
# smoothschedule/schedule/models.py
class ResourceType(models.Model):
"""Custom resource type definitions per business"""
business = models.ForeignKey('tenants.Business', on_delete=models.CASCADE, related_name='resource_types')
name = models.CharField(max_length=100) # "Stylist", "Treatment Room", etc.
category = models.CharField(max_length=10, choices=[
('STAFF', 'Staff'),
('OTHER', 'Other'),
])
is_default = models.BooleanField(default=False) # Cannot be deleted
icon_name = models.CharField(max_length=50, null=True, blank=True)
created_at = models.DateTimeField(auto_now_add=True)
class Meta:
unique_together = ['business', 'name']
ordering = ['name']
def __str__(self):
return f"{self.business.name} - {self.name}"
class Resource(models.Model):
"""Update existing Resource model"""
# ... existing fields ...
# NEW FIELD - references custom resource type
resource_type = models.ForeignKey(
ResourceType,
on_delete=models.PROTECT, # Cannot delete type if resources use it
related_name='resources',
null=True, # For migration
blank=True
)
# DEPRECATED - keep for backwards compatibility during migration
type = models.CharField(
max_length=20,
choices=[('STAFF', 'Staff'), ('ROOM', 'Room'), ('EQUIPMENT', 'Equipment')],
default='STAFF'
)
# smoothschedule/tenants/models.py
class Business(models.Model):
# ... existing fields ...
# NEW FIELD - logo upload
logo = models.ImageField(upload_to='business_logos/', null=True, blank=True)
```
### Migration Strategy
1. Create `ResourceType` model
2. For each business, create default resource types:
- "Staff" (category=STAFF, is_default=True)
- "Room" (category=OTHER, is_default=True)
- "Equipment" (category=OTHER, is_default=True)
3. Migrate existing resources to use default types based on their `type` field
4. Eventually deprecate `Resource.type` field
## API Endpoints
### Resource Types
```
GET /api/resource-types/ # List business resource types
POST /api/resource-types/ # Create new type
PATCH /api/resource-types/{id}/ # Update type
DELETE /api/resource-types/{id}/ # Delete type (if not in use & not default)
```
### Logo Upload
```
POST /api/business/logo/ # Upload logo
DELETE /api/business/logo/ # Remove logo
```
## Frontend Implementation
### 1. Business Settings - Resource Types Tab
```tsx
// Add new tab to Settings.tsx
Customize how you categorize your bookable resources.
{/* List of types */} {types.map(type => (