Initial commit: igny8 project

This commit is contained in:
igny8
2025-11-09 10:27:02 +00:00
commit 60b8188111
27265 changed files with 4360521 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
# Generated by Django 5.2.8 on 2025-11-07 10:37
import django.core.validators
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('igny8_core_auth', '0008_passwordresettoken_alter_industry_options_and_more'),
]
operations = [
migrations.CreateModel(
name='CreditTransaction',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('updated_at', models.DateTimeField(auto_now=True)),
('transaction_type', models.CharField(choices=[('purchase', 'Purchase'), ('subscription', 'Subscription Renewal'), ('refund', 'Refund'), ('deduction', 'Usage Deduction'), ('adjustment', 'Manual Adjustment')], db_index=True, max_length=20)),
('amount', models.IntegerField(help_text='Positive for additions, negative for deductions')),
('balance_after', models.IntegerField(help_text='Credit balance after this transaction')),
('description', models.CharField(max_length=255)),
('metadata', models.JSONField(default=dict, help_text='Additional context (AI call details, etc.)')),
('created_at', models.DateTimeField(auto_now_add=True)),
('tenant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.tenant')),
],
options={
'db_table': 'igny8_credit_transactions',
'ordering': ['-created_at'],
'indexes': [models.Index(fields=['tenant', 'transaction_type'], name='igny8_credi_tenant__c4281c_idx'), models.Index(fields=['tenant', 'created_at'], name='igny8_credi_tenant__69abd3_idx')],
},
),
migrations.CreateModel(
name='CreditUsageLog',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('updated_at', models.DateTimeField(auto_now=True)),
('operation_type', models.CharField(choices=[('clustering', 'Keyword Clustering'), ('ideas', 'Content Ideas Generation'), ('content', 'Content Generation'), ('images', 'Image Generation'), ('reparse', 'Content Reparse')], db_index=True, max_length=50)),
('credits_used', models.IntegerField(validators=[django.core.validators.MinValueValidator(0)])),
('cost_usd', models.DecimalField(blank=True, decimal_places=4, max_digits=10, null=True)),
('model_used', models.CharField(blank=True, max_length=100)),
('tokens_input', models.IntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0)])),
('tokens_output', models.IntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0)])),
('related_object_type', models.CharField(blank=True, max_length=50)),
('related_object_id', models.IntegerField(blank=True, null=True)),
('metadata', models.JSONField(default=dict)),
('created_at', models.DateTimeField(auto_now_add=True)),
('tenant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.tenant')),
],
options={
'db_table': 'igny8_credit_usage_logs',
'ordering': ['-created_at'],
'indexes': [models.Index(fields=['tenant', 'operation_type'], name='igny8_credi_tenant__3545ed_idx'), models.Index(fields=['tenant', 'created_at'], name='igny8_credi_tenant__4aee99_idx'), models.Index(fields=['tenant', 'operation_type', 'created_at'], name='igny8_credi_tenant__a00d57_idx')],
},
),
]