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

@@ -0,0 +1,103 @@
# Generated by Django 4.2.16 on 2026-11-06 13:26
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Category',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('external_id', models.CharField(max_length=64, unique=True)),
('name', models.CharField(max_length=255)),
('slug', models.SlugField(max_length=255, unique=True)),
('description', models.TextField(blank=True)),
('image_url', models.URLField(blank=True, max_length=1000)),
('is_active', models.BooleanField(default=True)),
('sort_order', models.IntegerField(default=0)),
('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='children', to='catalog.category')),
],
options={
'verbose_name': 'категория',
'verbose_name_plural': 'категории',
'db_table': 'catalog_category',
'ordering': ['sort_order', 'name'],
},
),
migrations.CreateModel(
name='Product',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('external_id', models.CharField(max_length=64, unique=True)),
('sku', models.CharField(db_index=True, max_length=64, verbose_name='артикул')),
('name', models.CharField(max_length=500)),
('slug', models.SlugField(max_length=500, unique=True)),
('brand', models.CharField(blank=True, max_length=255)),
('short_description', models.TextField(blank=True)),
('description', models.TextField(blank=True)),
('price', models.DecimalField(decimal_places=2, max_digits=12)),
('old_price', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True)),
('stock', models.IntegerField(default=0)),
('stock_status', models.CharField(choices=[('in_stock', 'В наличии'), ('preorder', 'Под заказ'), ('out_of_stock', 'Нет в наличии')], default='out_of_stock', max_length=20)),
('is_hit', models.BooleanField(default=False, verbose_name='хит продаж')),
('is_new', models.BooleanField(default=False, verbose_name='новинка')),
('is_active', models.BooleanField(default=True)),
('attributes', models.JSONField(blank=True, default=dict)),
('external_updated_at', models.DateTimeField(blank=True, null=True)),
('category', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='products', to='catalog.category')),
],
options={
'verbose_name': 'товар',
'verbose_name_plural': 'товары',
'db_table': 'catalog_product',
'ordering': ['-created_at'],
},
),
migrations.CreateModel(
name='ProductImage',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('url', models.URLField(max_length=1000)),
('alt', models.CharField(blank=True, max_length=255)),
('sort_order', models.IntegerField(default=0)),
('is_main', models.BooleanField(default=False)),
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='images', to='catalog.product')),
],
options={
'verbose_name': 'изображение товара',
'verbose_name_plural': 'изображения товаров',
'db_table': 'catalog_product_image',
'ordering': ['sort_order', 'id'],
},
),
migrations.AddIndex(
model_name='product',
index=models.Index(fields=['category', 'is_active'], name='catalog_pro_categor_891fe8_idx'),
),
migrations.AddIndex(
model_name='product',
index=models.Index(fields=['is_hit'], name='catalog_pro_is_hit_d36eb0_idx'),
),
migrations.AddIndex(
model_name='product',
index=models.Index(fields=['is_new'], name='catalog_pro_is_new_087fb1_idx'),
),
migrations.AddIndex(
model_name='product',
index=models.Index(fields=['price'], name='catalog_pro_price_2d2a4c_idx'),
),
]