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.
32 lines
645 B
Python
32 lines
645 B
Python
from celery import shared_task
|
|
|
|
from apps.orders.models import Order
|
|
|
|
from .services import (
|
|
process_outbox as _process_outbox,
|
|
pull_catalog_from_1c,
|
|
pull_order_statuses as _pull_order_statuses,
|
|
push_order_to_1c,
|
|
)
|
|
|
|
|
|
@shared_task
|
|
def sync_catalog_from_1c(since=None):
|
|
return pull_catalog_from_1c(since=since)
|
|
|
|
|
|
@shared_task
|
|
def push_order(order_id):
|
|
order = Order.objects.get(pk=order_id)
|
|
return push_order_to_1c(order)
|
|
|
|
|
|
@shared_task
|
|
def process_outbox(limit: int = 100):
|
|
return _process_outbox(limit=limit)
|
|
|
|
|
|
@shared_task
|
|
def pull_order_statuses(limit: int = 100):
|
|
return _pull_order_statuses(limit=limit)
|