documentverification/verifier/migrations/0001_initial.py
2026-10-15 19:42:15 +05:30

80 lines
4.3 KiB
Python

# Generated by Django 6.1 on 2026-10-15 14:09
import django.db.models.deletion
import uuid
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='VendorConfig',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='Unique vendor identifier, e.g. codeplus', max_length=50, unique=True)),
('display_name', models.CharField(help_text='Human-readable name', max_length=100)),
('is_active', models.BooleanField(default=True)),
('priority', models.PositiveIntegerField(default=10, help_text='Waterfall execution order (lower numbers execute first)')),
('supported_documents', models.JSONField(default=list, help_text="List of supported doc types: ['pan', 'aadhaar', 'driving_license', 'voter_id', ...]")),
('base_url', models.CharField(blank=True, max_length=255, null=True)),
('api_key', models.CharField(blank=True, max_length=255, null=True)),
('extra_credentials', models.JSONField(blank=True, default=dict)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
options={
'verbose_name': 'Vendor Configuration',
'verbose_name_plural': 'Vendor Configurations',
'ordering': ['priority', 'name'],
},
),
migrations.CreateModel(
name='VerificationTransaction',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('reference_id', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, unique=True)),
('document_type', models.CharField(db_index=True, max_length=50)),
('status', models.CharField(choices=[('PENDING', 'Pending'), ('SUCCESS', 'Success'), ('FAILED', 'Failed'), ('ERROR', 'Error')], db_index=True, default='PENDING', max_length=20)),
('successful_vendor', models.CharField(blank=True, max_length=50, null=True)),
('input_payload', models.JSONField(blank=True, default=dict)),
('final_data', models.JSONField(blank=True, default=dict)),
('attempts_count', models.PositiveIntegerField(default=0)),
('total_latency_ms', models.FloatField(default=0.0)),
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
options={
'verbose_name': 'Verification Transaction',
'verbose_name_plural': 'Verification Transactions',
'ordering': ['-created_at'],
},
),
migrations.CreateModel(
name='VendorAttemptLog',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('attempt_number', models.PositiveIntegerField()),
('vendor_name', models.CharField(db_index=True, max_length=50)),
('status', models.CharField(max_length=20)),
('is_success', models.BooleanField(default=False)),
('data', models.JSONField(blank=True, default=dict)),
('raw_response', models.JSONField(blank=True, null=True)),
('error_code', models.CharField(blank=True, max_length=100, null=True)),
('error_message', models.TextField(blank=True, null=True)),
('latency_ms', models.FloatField(default=0.0)),
('created_at', models.DateTimeField(auto_now_add=True)),
('transaction', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attempts', to='verifier.verificationtransaction')),
],
options={
'verbose_name': 'Vendor Attempt Log',
'verbose_name_plural': 'Vendor Attempt Logs',
'ordering': ['attempt_number'],
},
),
]