Adds the full Django application layer on top of sportstime_parser: - core: Sport, Team, Stadium, Game models with aliases and league structure - scraper: orchestration engine, adapter, job management, Celery tasks - cloudkit: CloudKit sync client, sync state tracking, sync jobs - dashboard: staff dashboard for monitoring scrapers, sync, review queue - notifications: email reports for scrape/sync results - Docker setup for deployment (Dockerfile, docker-compose, entrypoint) Game exports now use game_datetime_utc (ISO 8601 UTC) instead of venue-local date+time strings, matching the canonical format used by the iOS app. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
91 lines
6.0 KiB
Python
91 lines
6.0 KiB
Python
# Generated by Django 5.1.15 on 2026-01-26 08:59
|
|
|
|
import django.db.models.deletion
|
|
import simple_history.models
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
('cloudkit', '0001_initial'),
|
|
('scraper', '0001_initial'),
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='EmailConfiguration',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(default='Default', help_text='Configuration name', max_length=100)),
|
|
('is_enabled', models.BooleanField(default=True, help_text='Whether email notifications are enabled')),
|
|
('recipient_emails', models.TextField(help_text='Comma-separated list of recipient email addresses')),
|
|
('notify_on_scrape_complete', models.BooleanField(default=True, help_text='Send email after each scraper job completes')),
|
|
('notify_on_scrape_failure', models.BooleanField(default=True, help_text='Send email when scraper job fails')),
|
|
('notify_on_sync_complete', models.BooleanField(default=False, help_text='Send email after CloudKit sync completes')),
|
|
('notify_on_sync_failure', models.BooleanField(default=True, help_text='Send email when CloudKit sync fails')),
|
|
('notify_on_new_reviews', models.BooleanField(default=True, help_text='Include review items in scrape notifications')),
|
|
('min_games_for_notification', models.PositiveIntegerField(default=0, help_text='Minimum games changed to trigger notification (0 = always)')),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
],
|
|
options={
|
|
'verbose_name': 'Email Configuration',
|
|
'verbose_name_plural': 'Email Configurations',
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='EmailLog',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('subject', models.CharField(max_length=255)),
|
|
('recipients', models.TextField(help_text='Comma-separated list of recipients')),
|
|
('body_preview', models.TextField(blank=True, help_text='First 500 chars of email body')),
|
|
('status', models.CharField(choices=[('sent', 'Sent'), ('failed', 'Failed')], max_length=10)),
|
|
('error_message', models.TextField(blank=True)),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('configuration', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='logs', to='notifications.emailconfiguration')),
|
|
('scrape_job', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='email_logs', to='scraper.scrapejob')),
|
|
('sync_job', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='email_logs', to='cloudkit.cloudkitsyncjob')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Email Log',
|
|
'verbose_name_plural': 'Email Logs',
|
|
'ordering': ['-created_at'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='HistoricalEmailConfiguration',
|
|
fields=[
|
|
('id', models.BigIntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
|
|
('name', models.CharField(default='Default', help_text='Configuration name', max_length=100)),
|
|
('is_enabled', models.BooleanField(default=True, help_text='Whether email notifications are enabled')),
|
|
('recipient_emails', models.TextField(help_text='Comma-separated list of recipient email addresses')),
|
|
('notify_on_scrape_complete', models.BooleanField(default=True, help_text='Send email after each scraper job completes')),
|
|
('notify_on_scrape_failure', models.BooleanField(default=True, help_text='Send email when scraper job fails')),
|
|
('notify_on_sync_complete', models.BooleanField(default=False, help_text='Send email after CloudKit sync completes')),
|
|
('notify_on_sync_failure', models.BooleanField(default=True, help_text='Send email when CloudKit sync fails')),
|
|
('notify_on_new_reviews', models.BooleanField(default=True, help_text='Include review items in scrape notifications')),
|
|
('min_games_for_notification', models.PositiveIntegerField(default=0, help_text='Minimum games changed to trigger notification (0 = always)')),
|
|
('created_at', models.DateTimeField(blank=True, editable=False)),
|
|
('updated_at', models.DateTimeField(blank=True, editable=False)),
|
|
('history_id', models.AutoField(primary_key=True, serialize=False)),
|
|
('history_date', models.DateTimeField(db_index=True)),
|
|
('history_change_reason', models.CharField(max_length=100, null=True)),
|
|
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
|
|
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
|
|
],
|
|
options={
|
|
'verbose_name': 'historical Email Configuration',
|
|
'verbose_name_plural': 'historical Email Configurations',
|
|
'ordering': ('-history_date', '-history_id'),
|
|
'get_latest_by': ('history_date', 'history_id'),
|
|
},
|
|
bases=(simple_history.models.HistoricalChanges, models.Model),
|
|
),
|
|
]
|