fina autoamtiona adn billing and credits

This commit is contained in:
IGNY8 VPS (Salman)
2025-12-04 15:54:15 +00:00
parent f8a9293196
commit 40dfe20ead
40 changed files with 5680 additions and 18 deletions

View File

@@ -0,0 +1,39 @@
# Generated by Django 5.2.8 on 2025-12-04 14:38
import django.core.validators
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('billing', '0002_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='CreditCostConfig',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('operation_type', models.CharField(choices=[('clustering', 'Keyword Clustering'), ('idea_generation', 'Content Ideas Generation'), ('content_generation', 'Content Generation'), ('image_generation', 'Image Generation'), ('reparse', 'Content Reparse'), ('ideas', 'Content Ideas Generation'), ('content', 'Content Generation'), ('images', 'Image Generation')], help_text='AI operation type', max_length=50, unique=True)),
('credits_cost', models.IntegerField(help_text='Credits required for this operation', validators=[django.core.validators.MinValueValidator(0)])),
('unit', models.CharField(choices=[('per_request', 'Per Request'), ('per_100_words', 'Per 100 Words'), ('per_200_words', 'Per 200 Words'), ('per_item', 'Per Item'), ('per_image', 'Per Image')], default='per_request', help_text='What the cost applies to', max_length=50)),
('display_name', models.CharField(help_text='Human-readable name', max_length=100)),
('description', models.TextField(blank=True, help_text='What this operation does')),
('is_active', models.BooleanField(default=True, help_text='Enable/disable this operation')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('previous_cost', models.IntegerField(blank=True, help_text='Cost before last update (for audit trail)', null=True)),
('updated_by', models.ForeignKey(blank=True, help_text='Admin who last updated', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='credit_cost_updates', to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name': 'Credit Cost Configuration',
'verbose_name_plural': 'Credit Cost Configurations',
'db_table': 'igny8_credit_cost_config',
'ordering': ['operation_type'],
},
),
]