Automation Part 1

This commit is contained in:
IGNY8 VPS (Salman)
2025-12-03 08:07:43 +00:00
parent 5d96e1a2bd
commit b9774aafa2
23 changed files with 3444 additions and 1 deletions

View File

@@ -0,0 +1,89 @@
# Generated migration for automation models
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
('system', '__latest__'),
]
operations = [
migrations.CreateModel(
name='AutomationConfig',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('is_enabled', models.BooleanField(default=False, help_text='Enable/disable automation for this site')),
('frequency', models.CharField(
choices=[('daily', 'Daily'), ('weekly', 'Weekly'), ('monthly', 'Monthly')],
default='daily',
max_length=20
)),
('scheduled_time', models.TimeField(default='02:00', help_text='Time of day to run automation (HH:MM)')),
('stage_1_batch_size', models.IntegerField(default=20, help_text='Keywords → Clusters batch size')),
('stage_2_batch_size', models.IntegerField(default=1, help_text='Clusters → Ideas batch size')),
('stage_3_batch_size', models.IntegerField(default=20, help_text='Ideas → Tasks batch size')),
('stage_4_batch_size', models.IntegerField(default=1, help_text='Tasks → Content batch size')),
('stage_5_batch_size', models.IntegerField(default=1, help_text='Content → Image Prompts batch size')),
('stage_6_batch_size', models.IntegerField(default=1, help_text='Image Prompts → Images batch size')),
('last_run_at', models.DateTimeField(blank=True, null=True)),
('next_run_at', models.DateTimeField(blank=True, null=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='system.account')),
('site', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='automation_config', to='system.site')),
],
options={
'db_table': 'automation_config',
},
),
migrations.CreateModel(
name='AutomationRun',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('run_id', models.CharField(max_length=100, unique=True)),
('trigger_type', models.CharField(
choices=[('manual', 'Manual'), ('scheduled', 'Scheduled')],
default='manual',
max_length=20
)),
('status', models.CharField(
choices=[
('running', 'Running'),
('paused', 'Paused'),
('completed', 'Completed'),
('failed', 'Failed')
],
default='running',
max_length=20
)),
('current_stage', models.IntegerField(default=1, help_text='Current stage (1-7)')),
('stage_1_result', models.JSONField(blank=True, null=True)),
('stage_2_result', models.JSONField(blank=True, null=True)),
('stage_3_result', models.JSONField(blank=True, null=True)),
('stage_4_result', models.JSONField(blank=True, null=True)),
('stage_5_result', models.JSONField(blank=True, null=True)),
('stage_6_result', models.JSONField(blank=True, null=True)),
('stage_7_result', models.JSONField(blank=True, null=True)),
('total_credits_used', models.IntegerField(default=0)),
('error_message', models.TextField(blank=True, null=True)),
('started_at', models.DateTimeField(auto_now_add=True)),
('completed_at', models.DateTimeField(blank=True, null=True)),
('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='system.account')),
('site', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='automation_runs', to='system.site')),
],
options={
'db_table': 'automation_run',
'ordering': ['-started_at'],
'indexes': [
models.Index(fields=['site', 'status'], name='automation_site_status_idx'),
models.Index(fields=['site', 'started_at'], name='automation_site_started_idx'),
],
},
),
]

View File

@@ -0,0 +1 @@
"""Automation migrations"""