Files
homm/backend/apps/integration/management/commands/sync_catalog.py
T
apuc 756f40353b Add Django backend, 1C integration, deploy config and API docs
Backend (Django 4.2 + DRF):
- accounts: phone OTP login, JWT, profile, addresses
- catalog: categories, products, images, filters, search, hits/new/related
- orders: creation with Idempotency-Key, stock reservation, status history, cancel
- loyalty: bonus accounts, promo codes, gift certificates
- payments: payment records and YooKassa webhook handling
- content: static pages, banners, site settings
- integration: 1C exchange (catalog sync, order push via outbox, statuses, bonuses)
- common: error envelope, pagination, request-id, integration auth, admin dashboard

Infrastructure: Dockerfile, docker-compose (Postgres, Redis, Celery worker/beat, Nginx),
requirements split by environment, OpenAPI contracts for site and 1C, architecture doc.

Tests: 22 pytest cases covering catalog, orders, idempotency, OTP, integration.
2026-11-22 21:54:16 +03:00

21 lines
713 B
Python

from django.core.management.base import BaseCommand
from django.utils.dateparse import parse_datetime
from apps.integration.services import pull_catalog_from_1c
class Command(BaseCommand):
help = "Pull catalog changes from 1C and apply them to the store."
def add_arguments(self, parser):
parser.add_argument(
"--since",
default=None,
help="ISO datetime; only changes after this moment are requested.",
)
def handle(self, *args, **options):
since = parse_datetime(options["since"]) if options["since"] else None
stats = pull_catalog_from_1c(since=since)
self.stdout.write(self.style.SUCCESS(f"Catalog synced: {stats}"))