Add KYC monitoring model with shared base
All checks were successful
Build Docker Image / build (push) Successful in 1m37s

This commit is contained in:
Ruslan Bakiev
2026-01-14 21:11:49 +07:00
parent 9ae89b1270
commit ef4b6b6b1b
2 changed files with 66 additions and 3 deletions

View File

@@ -4,8 +4,9 @@ from django.contrib.contenttypes.models import ContentType
import uuid
class KYCRequest(models.Model):
"""Главная модель KYC заявки. Ссылается на детали страны через ContentType."""
class AbstractKycBase(models.Model):
"""Общая база для KYC сущностей с идентичными полями."""
WORKFLOW_STATUS_CHOICES = [
('pending', 'Ожидает обработки'),
('active', 'Активен'),
@@ -44,6 +45,23 @@ class KYCRequest(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
class Meta:
abstract = True
class KYCRequest(AbstractKycBase):
"""Главная модель KYC заявки. Ссылается на детали страны через ContentType."""
content_type = models.ForeignKey(
ContentType,
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name='kyc_requests'
)
object_id = models.PositiveIntegerField(null=True, blank=True)
country_details = GenericForeignKey('content_type', 'object_id')
class Meta:
db_table = 'kyc_requests'
@@ -57,6 +75,26 @@ class KYCRequest(models.Model):
return {}
class KYCMonitoring(AbstractKycBase):
"""KYC мониторинг (копия заявки для долгосрочного наблюдения)."""
content_type = models.ForeignKey(
ContentType,
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name='kyc_monitoring'
)
object_id = models.PositiveIntegerField(null=True, blank=True)
country_details = GenericForeignKey('content_type', 'object_id')
class Meta:
db_table = 'kyc_monitoring'
def __str__(self):
return f"KYC Monitoring {self.user_id} - {self.workflow_status}"
class KYCRequestRussia(models.Model):
"""Детали KYC для России. Отдельная модель без наследования."""