quantum-ai-v2/agents/migrations/0001_initial.py
Claude 5eba8fee84 🚀 Complete agents app implementation with social ads frontend
- Create complete REST API-based agents system for scalability
- Implement Social Ads Generator with dynamic form rendering
- Add agents marketplace with search and category filtering
- Build real-time wallet balance updates after execution
- Fix URL routing conflicts and API endpoint issues
- Add comprehensive N8N webhook integration with proper payload format
- Create dynamic template system for 100+ agent scalability

Features:
- Database-driven agent management via Django admin
- JSON schema-based dynamic form generation
- Real-time wallet balance deduction and display updates
- Comprehensive error handling and validation
- Mobile-responsive marketplace UI
- Complete API endpoints for frontend integration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-31 19:05:09 +05:30

141 lines
4.9 KiB
Python

# Generated by Django 5.2.4 on 2025-07-31 04:22
import django.db.models.deletion
import uuid
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name="AgentCategory",
fields=[
(
"id",
models.UUIDField(
default=uuid.uuid4,
editable=False,
primary_key=True,
serialize=False,
),
),
("name", models.CharField(max_length=100)),
("slug", models.SlugField(unique=True)),
("description", models.TextField(blank=True)),
(
"icon",
models.CharField(
blank=True, help_text="Icon class or emoji", max_length=50
),
),
("is_active", models.BooleanField(default=True)),
("created_at", models.DateTimeField(auto_now_add=True)),
],
options={
"ordering": ["name"],
},
),
migrations.CreateModel(
name="Agent",
fields=[
(
"id",
models.UUIDField(
default=uuid.uuid4,
editable=False,
primary_key=True,
serialize=False,
),
),
("name", models.CharField(max_length=200)),
("slug", models.SlugField(unique=True)),
("short_description", models.CharField(max_length=300)),
("description", models.TextField()),
("price", models.DecimalField(decimal_places=2, max_digits=10)),
(
"form_schema",
models.JSONField(help_text="JSON schema for agent input form"),
),
(
"webhook_url",
models.URLField(help_text="n8n webhook URL for execution"),
),
("is_active", models.BooleanField(default=True)),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"category",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="agents",
to="agents.agentcategory",
),
),
],
options={
"ordering": ["name"],
},
),
migrations.CreateModel(
name="AgentExecution",
fields=[
(
"id",
models.UUIDField(
default=uuid.uuid4,
editable=False,
primary_key=True,
serialize=False,
),
),
("input_data", models.JSONField()),
("output_data", models.JSONField(blank=True, null=True)),
(
"status",
models.CharField(
choices=[
("pending", "Pending"),
("running", "Running"),
("completed", "Completed"),
("failed", "Failed"),
],
default="pending",
max_length=20,
),
),
("fee_charged", models.DecimalField(decimal_places=2, max_digits=10)),
("webhook_response", models.JSONField(blank=True, null=True)),
("error_message", models.TextField(blank=True)),
("execution_time", models.DurationField(blank=True, null=True)),
("created_at", models.DateTimeField(auto_now_add=True)),
("completed_at", models.DateTimeField(blank=True, null=True)),
(
"agent",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="executions",
to="agents.agent",
),
),
(
"user",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
),
),
],
options={
"ordering": ["-created_at"],
},
),
]