winofy-backend/apps/catalog/migrations/0001_initial.py
Ali Asadi 52adc732fa Initial Winofy backend: marketplace core (no payment integration)
Django 6 + DRF resource server against the Gooyal accounts OAuth2 service,
matching the Winsoo ecosystem's conventions. Covers locations, stores,
catalog, cart, checkout/orders (with the multi-store-cart split and the
status stepper), reviews, and notifications, plus a demo-data seed command.

Payment integration (wallet debits, online gateway, seller payouts) is
intentionally left out here — see feature/payment.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-10 14:03:15 +03:30

59 lines
3 KiB
Python

# Generated by Django 6.0.2 on 2026-08-09 10:29
import django.db.models.deletion
import uuid
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('stores', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='ProductCategory',
fields=[
('uuid', models.UUIDField(db_index=True, default=uuid.uuid4, primary_key=True, serialize=False, unique=True)),
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
('updated_at', models.DateTimeField(auto_now=True, db_index=True)),
('name', models.CharField(max_length=100)),
('icon', models.ImageField(blank=True, null=True, upload_to='product_categories/')),
('order', models.PositiveSmallIntegerField(default=0)),
('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='catalog.productcategory')),
],
options={
'verbose_name': 'دسته\u200cبندی محصول',
'verbose_name_plural': 'دسته\u200cبندی\u200cهای محصول',
'ordering': ['order', 'name'],
},
),
migrations.CreateModel(
name='Product',
fields=[
('uuid', models.UUIDField(db_index=True, default=uuid.uuid4, primary_key=True, serialize=False, unique=True)),
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
('updated_at', models.DateTimeField(auto_now=True, db_index=True)),
('name', models.CharField(max_length=200)),
('description', models.TextField(blank=True)),
('image', models.ImageField(blank=True, null=True, upload_to='products/')),
('price', models.PositiveBigIntegerField()),
('unit_type', models.CharField(choices=[('gram', 'گرم'), ('ml', 'میلی\u200cلیتر'), ('piece', 'عدد')], default='piece', max_length=10)),
('unit_value', models.PositiveIntegerField(blank=True, null=True)),
('stock_quantity', models.PositiveIntegerField(default=0)),
('low_stock_threshold', models.PositiveIntegerField(default=5)),
('is_active', models.BooleanField(default=True)),
('sold_count', models.PositiveIntegerField(default=0)),
('store', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='products', to='stores.store')),
('category', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='products', to='catalog.productcategory')),
],
options={
'verbose_name': 'محصول',
'verbose_name_plural': 'محصولات',
'ordering': ['-created_at'],
},
),
]