feat: use authoritative organization directory
Some checks failed
CI/CD Pipeline / Quality Gate (push) Failing after 9s
CI/CD Pipeline / Build and Push Images (push) Has been skipped
CI/CD Pipeline / Deploy Dev via Compose (push) Has been skipped
CI/CD Pipeline / Internal Notify (push) Successful in 0s

This commit is contained in:
2026-06-07 16:04:43 +02:00
parent 79f0f8ebf7
commit 6ba8fa8d88
41 changed files with 2781 additions and 1058 deletions

View File

@@ -0,0 +1,35 @@
"""Import the authoritative organizations directory."""
from __future__ import annotations
import json
from apps.core.management.commands.base import BaseAppCommand
from organizations.directory_import import OrganizationDirectoryImportService
class Command(BaseAppCommand):
"""Import organizations from the authoritative XLSX file."""
help = "Импортирует справочник organizations.Organization из перечня XLSX"
use_transaction = False
def add_arguments(self, parser) -> None:
super().add_arguments(parser)
parser.add_argument("path", help="Путь к файлу перечня организаций XLSX.")
def execute_command(self, *args, **options) -> str:
result = OrganizationDirectoryImportService.import_xlsx(options["path"])
rendered = json.dumps(
{
"scanned": result.scanned,
"created": result.created,
"updated": result.updated,
"skipped": result.skipped,
},
ensure_ascii=False,
sort_keys=True,
)
self.log_success(rendered)
return rendered