mirror of
https://github.com/thecyberlearn/netcop-ai.git
synced 2026-08-18 10:52:59 +00:00
- Add new Django apps: agents and frontend with URL routing - Configure static files and templates directories in settings - Add CSRF exemption and authentication to user endpoints - Switch Stripe currency from USD to AED - Add user management script and static assets - Include REST framework token authentication 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
80 lines
4.2 KiB
Python
80 lines
4.2 KiB
Python
# Generated by Django 5.0.8 on 2025-07-30 10:09
|
|
|
|
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 name or emoji', max_length=50)),
|
|
('is_active', models.BooleanField(default=True)),
|
|
('sort_order', models.IntegerField(default=0)),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
],
|
|
options={
|
|
'verbose_name_plural': 'Agent Categories',
|
|
'ordering': ['sort_order', '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)),
|
|
('description', models.TextField()),
|
|
('short_description', models.CharField(help_text='Brief description for cards', max_length=255)),
|
|
('price', models.DecimalField(decimal_places=2, help_text='Price in AED', max_digits=10)),
|
|
('icon', models.CharField(blank=True, help_text='Icon name or emoji', max_length=50)),
|
|
('form_schema', models.JSONField(default=dict, help_text='JSON schema defining the form fields for this agent')),
|
|
('n8n_webhook_url', models.URLField(help_text='n8n webhook URL for this agent')),
|
|
('result_format', models.JSONField(blank=True, default=dict, help_text='Configuration for formatting the response from n8n')),
|
|
('is_active', models.BooleanField(default=True)),
|
|
('is_featured', models.BooleanField(default=False)),
|
|
('usage_count', models.IntegerField(default=0)),
|
|
('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': ['-is_featured', '-usage_count', 'name'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='AgentExecution',
|
|
fields=[
|
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
('input_data', models.JSONField(help_text='Form data submitted by user')),
|
|
('output_data', models.JSONField(blank=True, help_text='Response from n8n workflow', null=True)),
|
|
('price_paid', models.DecimalField(decimal_places=2, max_digits=10)),
|
|
('status', models.CharField(choices=[('pending', 'Pending'), ('processing', 'Processing'), ('success', 'Success'), ('failed', 'Failed')], default='pending', max_length=20)),
|
|
('error_message', models.TextField(blank=True, null=True)),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('updated_at', models.DateTimeField(auto_now=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, related_name='agent_executions', to=settings.AUTH_USER_MODEL)),
|
|
],
|
|
options={
|
|
'ordering': ['-created_at'],
|
|
},
|
|
),
|
|
]
|