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.
This commit is contained in:
apuc committed 2026-11-22 21:54:16 +03:00
1 parent 5f8d37357d
commit 756f40353b
130 files changed
+10066

No files matched your search

+53
View File
@@ -0,0 +1,53 @@
{% extends "admin/index.html" %}
{% load admin_metrics %}
{% block content %}
{% admin_metrics as m %}
<div class="module" style="margin-bottom:20px;">
<h2>Сводка</h2>
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px;padding:12px;">
<a href="{% url 'admin:orders_order_changelist' %}" style="text-decoration:none;color:inherit;border:1px solid #e5e7eb;border-radius:8px;padding:12px;background:#fff;">
<div style="font-size:12px;color:#6b7280;">Заказы сегодня</div>
<div style="font-size:26px;font-weight:600;">{{ m.orders_today }}</div>
</a>
<a href="{% url 'admin:orders_order_changelist' %}" style="text-decoration:none;color:inherit;border:1px solid #e5e7eb;border-radius:8px;padding:12px;background:#fff;">
<div style="font-size:12px;color:#6b7280;">Выручка сегодня</div>
<div style="font-size:26px;font-weight:600;">{{ m.revenue_today }} ₽</div>
</a>
<a href="{% url 'admin:orders_order_changelist' %}?status__exact=new" style="text-decoration:none;color:inherit;border:1px solid #e5e7eb;border-radius:8px;padding:12px;background:#fff;">
<div style="font-size:12px;color:#6b7280;">Заказы в работе</div>
<div style="font-size:26px;font-weight:600;">{{ m.orders_pending }}</div>
</a>
<a href="{% url 'admin:integration_outboxmessage_changelist' %}?status__exact=pending" style="text-decoration:none;color:inherit;border:1px solid #e5e7eb;border-radius:8px;padding:12px;background:#fff;">
<div style="font-size:12px;color:#6b7280;">Очередь в 1С</div>
<div style="font-size:26px;font-weight:600;">{{ m.outbox_pending }}</div>
</a>
<a href="{% url 'admin:integration_outboxmessage_changelist' %}?status__exact=dead" style="text-decoration:none;color:inherit;border:1px solid #e5e7eb;border-radius:8px;padding:12px;background:#fff;">
<div style="font-size:12px;color:#6b7280;">Ошибки обмена</div>
<div style="font-size:26px;font-weight:600;color:{% if m.outbox_dead %}#dc2626{% else %}#111827{% endif %};">{{ m.outbox_dead }}</div>
</a>
<a href="{% url 'admin:catalog_product_changelist' %}" style="text-decoration:none;color:inherit;border:1px solid #e5e7eb;border-radius:8px;padding:12px;background:#fff;">
<div style="font-size:12px;color:#6b7280;">Активных товаров</div>
<div style="font-size:26px;font-weight:600;">{{ m.products_count }}</div>
</a>
<a href="{% url 'admin:accounts_user_changelist' %}" style="text-decoration:none;color:inherit;border:1px solid #e5e7eb;border-radius:8px;padding:12px;background:#fff;">
<div style="font-size:12px;color:#6b7280;">Пользователей</div>
<div style="font-size:26px;font-weight:600;">{{ m.users_count }}</div>
</a>
<a href="{% url 'admin:catalog_product_changelist' %}" style="text-decoration:none;color:inherit;border:1px solid #e5e7eb;border-radius:8px;padding:12px;background:#fff;">
<div style="font-size:12px;color:#6b7280;">Мало на складе</div>
<div style="font-size:26px;font-weight:600;">{{ m.low_stock }}</div>
</a>
</div>
<div style="padding:0 12px 12px;font-size:13px;color:#4b5563;">
Последний обмен с 1С:
{% if m.last_sync %}
<a href="{% url 'admin:integration_syncrun_changelist' %}">{{ m.last_sync.get_entity_display }}</a>
— {{ m.last_sync.get_status_display }}, {{ m.last_sync.started_at }}
{% else %}
обменов ещё не было
{% endif %}
</div>
</div>
{{ block.super }}
{% endblock %}