Restructured 13 Django apps from flat/mixed organization into 5 logical
domain packages following cookiecutter-django conventions:
- identity/: core (tenant/domain models, middleware, mixins), users
- scheduling/: schedule, contracts, analytics
- communication/: notifications, credits, mobile, messaging
- commerce/: payments, tickets
- platform/: admin, api
Key changes:
- Moved all apps to smoothschedule/smoothschedule/{domain}/{app}/
- Updated all import paths across the codebase
- Updated settings (base.py, multitenancy.py, test.py)
- Updated URL configuration in config/urls.py
- Updated middleware and permission paths
- Preserved app_label in AppConfig for migration compatibility
- Updated CLAUDE.md documentation with new structure
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
#!/usr/bin/env python
|
|
"""Create a platform admin user for testing."""
|
|
import os
|
|
import django
|
|
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
|
|
django.setup()
|
|
|
|
from smoothschedule.identity.users.models import User
|
|
from rest_framework.authtoken.models import Token
|
|
|
|
# Create or get a superuser with platform admin role
|
|
user, created = User.objects.get_or_create(
|
|
username='admin',
|
|
defaults={
|
|
'email': 'admin@smoothschedule.com',
|
|
'is_staff': True,
|
|
'is_superuser': True,
|
|
'role': User.Role.SUPERUSER,
|
|
}
|
|
)
|
|
|
|
if created:
|
|
user.set_password('admin123')
|
|
user.save()
|
|
print(f"Created new superuser: {user.username}")
|
|
else:
|
|
user.role = User.Role.SUPERUSER
|
|
user.is_staff = True
|
|
user.is_superuser = True
|
|
user.set_password('admin123')
|
|
user.save()
|
|
print(f"Updated existing user: {user.username}")
|
|
|
|
# Create or get auth token
|
|
token, _ = Token.objects.get_or_create(user=user)
|
|
print(f"\nAuth token: {token.key}")
|
|
print(f"User role: {user.role}")
|
|
print(f"\nYou can now use this token to test the API:")
|
|
print(f'curl -H "Authorization: Token {token.key}" http://lvh.me:8000/api/platform/businesses/')
|