97 lines
5.3 KiB
Python
97 lines
5.3 KiB
Python
# Generated by Django 4.2.30 on 2026-05-18 17:55
|
|
|
|
from django.conf import settings
|
|
import django.core.validators
|
|
from django.db import migrations, models
|
|
import django.db.models.deletion
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='Item',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('title', models.CharField(max_length=200)),
|
|
('brand', models.CharField(blank=True, max_length=120)),
|
|
('category', models.CharField(max_length=80)),
|
|
('condition', models.CharField(blank=True, max_length=80)),
|
|
('size', models.CharField(blank=True, max_length=50)),
|
|
('color', models.CharField(blank=True, max_length=80)),
|
|
('purchase_price', models.DecimalField(decimal_places=2, max_digits=10, validators=[django.core.validators.MinValueValidator(0)])),
|
|
('estimated_resale_price', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
|
|
('sold_price', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
|
|
('ebay_fee', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
|
|
('shipping_cost', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
|
|
('status', models.CharField(choices=[('in_stock', 'In stock'), ('listed', 'Listed'), ('sold', 'Sold'), ('donated', 'Donated')], default='in_stock', max_length=20)),
|
|
('notes', models.TextField(blank=True)),
|
|
('acquisition_date', models.DateField(auto_now_add=True)),
|
|
('sold_at', models.DateTimeField(blank=True, null=True)),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='items_created', to=settings.AUTH_USER_MODEL)),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='ItemTemplate',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=120, unique=True)),
|
|
('description', models.TextField(blank=True)),
|
|
('category', models.CharField(max_length=80)),
|
|
('default_purchase_price', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
|
|
('default_estimated_resale_price', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
|
|
('default_notes', models.TextField(blank=True)),
|
|
('is_active', models.BooleanField(default=True)),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='PriceEstimate',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('source', models.CharField(max_length=80)),
|
|
('source_url', models.URLField(blank=True)),
|
|
('estimated_price', models.DecimalField(decimal_places=2, max_digits=10)),
|
|
('notes', models.TextField(blank=True)),
|
|
('retrieved_at', models.DateTimeField(auto_now_add=True)),
|
|
('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='price_estimates', to='inventory.item')),
|
|
],
|
|
options={
|
|
'ordering': ['-retrieved_at'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='ItemPhoto',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('file', models.FileField(upload_to='item-photos/')),
|
|
('uploaded_at', models.DateTimeField(auto_now_add=True)),
|
|
('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='photos', to='inventory.item')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='ItemNote',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('body', models.TextField()),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
|
|
('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notes_history', to='inventory.item')),
|
|
],
|
|
),
|
|
migrations.AddField(
|
|
model_name='item',
|
|
name='template',
|
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='items', to='inventory.itemtemplate'),
|
|
),
|
|
]
|