Implement exchange imports and frontend reporting APIs
Some checks failed
CI/CD Pipeline / Code Quality Checks (push) Failing after 3m50s
CI/CD Pipeline / Run Tests (push) Successful in 3m57s
CI/CD Pipeline / Build Docker Images (push) Has been skipped
CI/CD Pipeline / Push to Gitea Registry (push) Has been skipped
CI/CD Pipeline / Deploy to Server (push) Has been skipped
Some checks failed
CI/CD Pipeline / Code Quality Checks (push) Failing after 3m50s
CI/CD Pipeline / Run Tests (push) Successful in 3m57s
CI/CD Pipeline / Build Docker Images (push) Has been skipped
CI/CD Pipeline / Push to Gitea Registry (push) Has been skipped
CI/CD Pipeline / Deploy to Server (push) Has been skipped
This commit is contained in:
113
src/apps/external_data/models.py
Normal file
113
src/apps/external_data/models.py
Normal file
@@ -0,0 +1,113 @@
|
||||
"""Models for external read-only registries."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from apps.core.mixins import TimestampMixin, UUIDPrimaryKeyMixin
|
||||
from apps.organization.models import Organization
|
||||
|
||||
|
||||
class IndustrialProduct(UUIDPrimaryKeyMixin, TimestampMixin, models.Model):
|
||||
organization = models.ForeignKey(
|
||||
Organization,
|
||||
on_delete=models.CASCADE,
|
||||
related_name="industrial_products",
|
||||
verbose_name=_("организация"),
|
||||
)
|
||||
product_name = models.CharField(
|
||||
_("наименование продукции"), max_length=500, db_index=True
|
||||
)
|
||||
product_class = models.CharField(
|
||||
_("класс продукции"), max_length=100, db_index=True
|
||||
)
|
||||
okpd2_code = models.CharField(_("код ОКПД2"), max_length=32, blank=True, default="")
|
||||
tnved_code = models.CharField(_("код ТНВЭД"), max_length=32, blank=True, default="")
|
||||
registry_number = models.CharField(
|
||||
_("реестровый номер"), max_length=64, blank=True, default=""
|
||||
)
|
||||
|
||||
class Meta:
|
||||
ordering = ["product_name", "created_at"]
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"{self.product_name} ({self.organization_id})"
|
||||
|
||||
|
||||
class ProsecutorCheck(UUIDPrimaryKeyMixin, TimestampMixin, models.Model):
|
||||
organization = models.ForeignKey(
|
||||
Organization,
|
||||
on_delete=models.CASCADE,
|
||||
related_name="prosecutor_checks",
|
||||
verbose_name=_("организация"),
|
||||
)
|
||||
registration_number = models.CharField(
|
||||
_("регистрационный номер"), max_length=64, db_index=True
|
||||
)
|
||||
law_type = models.CharField(_("тип закона"), max_length=32, db_index=True)
|
||||
control_authority = models.CharField(_("контрольный орган"), max_length=255)
|
||||
prosecutor_office = models.CharField(
|
||||
_("прокуратура"), max_length=255, blank=True, default=""
|
||||
)
|
||||
start_date = models.DateField(_("дата начала"), db_index=True)
|
||||
status = models.CharField(_("статус"), max_length=64, db_index=True)
|
||||
|
||||
class Meta:
|
||||
ordering = ["-start_date", "registration_number"]
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"{self.registration_number} ({self.organization_id})"
|
||||
|
||||
|
||||
class PublicProcurement(UUIDPrimaryKeyMixin, TimestampMixin, models.Model):
|
||||
organization = models.ForeignKey(
|
||||
Organization,
|
||||
on_delete=models.CASCADE,
|
||||
related_name="public_procurements",
|
||||
verbose_name=_("организация"),
|
||||
)
|
||||
purchase_number = models.CharField(_("номер закупки"), max_length=64, db_index=True)
|
||||
law_type = models.CharField(_("тип закона"), max_length=32, db_index=True)
|
||||
status = models.CharField(_("статус"), max_length=64, db_index=True)
|
||||
contract_amount = models.DecimalField(
|
||||
_("сумма контракта"),
|
||||
max_digits=20,
|
||||
decimal_places=2,
|
||||
null=True,
|
||||
blank=True,
|
||||
)
|
||||
contract_date = models.DateField(_("дата контракта"), db_index=True)
|
||||
execution_start_date = models.DateField(
|
||||
_("дата начала исполнения"), null=True, blank=True
|
||||
)
|
||||
execution_end_date = models.DateField(
|
||||
_("дата окончания исполнения"), null=True, blank=True
|
||||
)
|
||||
purchase_name = models.CharField(_("предмет закупки"), max_length=500)
|
||||
|
||||
class Meta:
|
||||
ordering = ["-contract_date", "purchase_number"]
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"{self.purchase_number} ({self.organization_id})"
|
||||
|
||||
|
||||
class ArbitrationCase(UUIDPrimaryKeyMixin, TimestampMixin, models.Model):
|
||||
organization = models.ForeignKey(
|
||||
Organization,
|
||||
on_delete=models.CASCADE,
|
||||
related_name="arbitration_cases",
|
||||
verbose_name=_("организация"),
|
||||
)
|
||||
case_number = models.CharField(_("номер дела"), max_length=64, db_index=True)
|
||||
court_name = models.CharField(_("суд"), max_length=255)
|
||||
party_role = models.CharField(_("роль стороны"), max_length=64, db_index=True)
|
||||
status = models.CharField(_("статус"), max_length=64, db_index=True)
|
||||
decision_date = models.DateField(_("дата решения"), db_index=True)
|
||||
|
||||
class Meta:
|
||||
ordering = ["-decision_date", "case_number"]
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"{self.case_number} ({self.organization_id})"
|
||||
Reference in New Issue
Block a user