diff --git a/ERD/Backend_ERD.drawio.png b/ERD/Backend_ERD.drawio.png index 5c6d980..3074d49 100644 Binary files a/ERD/Backend_ERD.drawio.png and b/ERD/Backend_ERD.drawio.png differ diff --git a/ERD/Final_Backend_ERD.png b/ERD/Final_Backend_ERD.png new file mode 100644 index 0000000..4d90e5d Binary files /dev/null and b/ERD/Final_Backend_ERD.png differ diff --git a/equipment_tracker/schema.yml b/equipment_tracker/schema.yml index d19016d..84602d4 100644 --- a/equipment_tracker/schema.yml +++ b/equipment_tracker/schema.yml @@ -1589,6 +1589,8 @@ components: type: string format: date-time readOnly: true + section: + type: string SendEmailReset: type: object properties: @@ -1705,10 +1707,13 @@ components: type: string format: date-time readOnly: true + section: + type: string required: - borrower - equipments - id + - section - subject - teacher - timestamp diff --git a/equipment_tracker/transactions/migrations/0003_transaction_section.py b/equipment_tracker/transactions/migrations/0003_transaction_section.py new file mode 100644 index 0000000..cdc19b0 --- /dev/null +++ b/equipment_tracker/transactions/migrations/0003_transaction_section.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0.1 on 2024-01-11 03:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('transactions', '0002_alter_transaction_transaction_status'), + ] + + operations = [ + migrations.AddField( + model_name='transaction', + name='section', + field=models.CharField(max_length=255, null=True), + ), + ] diff --git a/equipment_tracker/transactions/models.py b/equipment_tracker/transactions/models.py index 65f735c..08551f4 100644 --- a/equipment_tracker/transactions/models.py +++ b/equipment_tracker/transactions/models.py @@ -38,6 +38,7 @@ class Transaction(models.Model): max_length=40, choices=TRANSACTION_STATUS_CHOICES, default='Pending', db_index=True) subject = models.TextField(max_length=128) timestamp = models.DateTimeField(default=now, editable=False) + section = models.CharField(max_length=255, null=True) def __str__(self): return f"Transaction #{self.id} under {self.teacher} by {self.borrower}" diff --git a/equipment_tracker/transactions/serializers.py b/equipment_tracker/transactions/serializers.py index ee57a97..71bb333 100644 --- a/equipment_tracker/transactions/serializers.py +++ b/equipment_tracker/transactions/serializers.py @@ -41,6 +41,7 @@ class TransactionSerializer(serializers.HyperlinkedModelSerializer): required=False, allow_null=True, allow_blank=True) timestamp = serializers.DateTimeField( format="%m-%d-%Y %I:%M %p", read_only=True) + section = serializers.CharField(required=True, allow_null=False) transaction_status = serializers.ChoiceField( choices=Transaction.TRANSACTION_STATUS_CHOICES) @@ -48,7 +49,7 @@ class TransactionSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Transaction fields = ['id', 'borrower', 'teacher', 'subject', - 'equipments', 'remarks', 'transaction_status', 'additional_members', 'consumables', 'timestamp'] + 'equipments', 'remarks', 'transaction_status', 'additional_members', 'consumables', 'timestamp', 'section'] read_only_fields = ['id', 'timestamp'] def to_representation(self, instance):