diff --git a/core/core/settings.py b/core/core/settings.py index 805a27b..90e026b 100644 --- a/core/core/settings.py +++ b/core/core/settings.py @@ -70,6 +70,7 @@ INSTALLED_APPS = [ 'inventory', 'mail', 'notify_sessions', + 'shipments' ] REST_FRAMEWORK = { diff --git a/core/shipments/__init__.py b/core/shipments/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/core/shipments/api_v2.py b/core/shipments/api_v2.py new file mode 100644 index 0000000..e69de29 diff --git a/core/shipments/migrations/0001_initial.py b/core/shipments/migrations/0001_initial.py new file mode 100644 index 0000000..eb889e2 --- /dev/null +++ b/core/shipments/migrations/0001_initial.py @@ -0,0 +1,37 @@ +# Generated by Django 4.2.7 on 2025-03-15 21:37 + +from django.db import migrations, models +import django.db.models.manager +import uuid + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('inventory', '0007_rename_container_item_container_old_itemplacement_and_more'), + ('tickets', '0013_alter_statechange_state'), + ] + + operations = [ + migrations.CreateModel( + name='Shipment', + fields=[ + ('is_deleted', models.BooleanField(default=False)), + ('deleted_at', models.DateTimeField(blank=True, null=True)), + ('id', models.AutoField(primary_key=True, serialize=False)), + ('public_secret', models.UUIDField(default=uuid.uuid4)), + ('created_at', models.DateTimeField(auto_now_add=True, null=True)), + ('updated_at', models.DateTimeField(blank=True, null=True)), + ('related_items', models.ManyToManyField(to='inventory.item')), + ('related_tickets', models.ManyToManyField(to='tickets.issuethread')), + ], + options={ + 'abstract': False, + }, + managers=[ + ('all_objects', django.db.models.manager.Manager()), + ], + ), + ] diff --git a/core/shipments/migrations/__init__.py b/core/shipments/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/core/shipments/models.py b/core/shipments/models.py new file mode 100644 index 0000000..b60f56a --- /dev/null +++ b/core/shipments/models.py @@ -0,0 +1,21 @@ +import uuid + +from django.db import models +from django_softdelete.models import SoftDeleteModel, SoftDeleteManager +from inventory.models import Item +from tickets.models import IssueThread + +class Shipment(SoftDeleteModel): + id = models.AutoField(primary_key=True) + public_secret = models.UUIDField(default = uuid.uuid4) + + related_items = models.ManyToManyField(Item) + related_tickets = models.ManyToManyField(IssueThread) + + created_at = models.DateTimeField(null=True, auto_now_add=True) + updated_at = models.DateTimeField(blank=True, null=True) + + all_objects = models.Manager() + + def __str__(self): + return '[' + str(self.id) + ']' + self.description \ No newline at end of file