mirror of
https://github.com/lemeow125/Borrowing-TrackerBackend.git
synced 2024-11-16 22:09:27 +08:00
added section then changes in erd
This commit is contained in:
parent
e8524e1d45
commit
ba9121d880
6 changed files with 26 additions and 1 deletions
Binary file not shown.
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 79 KiB |
BIN
ERD/Final_Backend_ERD.png
Normal file
BIN
ERD/Final_Backend_ERD.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 121 KiB |
|
@ -1572,6 +1572,8 @@ components:
|
||||||
type: string
|
type: string
|
||||||
format: date-time
|
format: date-time
|
||||||
readOnly: true
|
readOnly: true
|
||||||
|
section:
|
||||||
|
type: string
|
||||||
SendEmailReset:
|
SendEmailReset:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
@ -1688,10 +1690,13 @@ components:
|
||||||
type: string
|
type: string
|
||||||
format: date-time
|
format: date-time
|
||||||
readOnly: true
|
readOnly: true
|
||||||
|
section:
|
||||||
|
type: string
|
||||||
required:
|
required:
|
||||||
- borrower
|
- borrower
|
||||||
- equipments
|
- equipments
|
||||||
- id
|
- id
|
||||||
|
- section
|
||||||
- subject
|
- subject
|
||||||
- teacher
|
- teacher
|
||||||
- timestamp
|
- timestamp
|
||||||
|
|
|
@ -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),
|
||||||
|
),
|
||||||
|
]
|
|
@ -38,6 +38,7 @@ class Transaction(models.Model):
|
||||||
max_length=40, choices=TRANSACTION_STATUS_CHOICES, default='Pending', db_index=True)
|
max_length=40, choices=TRANSACTION_STATUS_CHOICES, default='Pending', db_index=True)
|
||||||
subject = models.TextField(max_length=128)
|
subject = models.TextField(max_length=128)
|
||||||
timestamp = models.DateTimeField(default=now, editable=False)
|
timestamp = models.DateTimeField(default=now, editable=False)
|
||||||
|
section = models.CharField(max_length=255, null=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"Transaction #{self.id} under {self.teacher} by {self.borrower}"
|
return f"Transaction #{self.id} under {self.teacher} by {self.borrower}"
|
||||||
|
|
|
@ -41,6 +41,7 @@ class TransactionSerializer(serializers.HyperlinkedModelSerializer):
|
||||||
required=False, allow_null=True, allow_blank=True)
|
required=False, allow_null=True, allow_blank=True)
|
||||||
timestamp = serializers.DateTimeField(
|
timestamp = serializers.DateTimeField(
|
||||||
format="%m-%d-%Y %I:%M %p", read_only=True)
|
format="%m-%d-%Y %I:%M %p", read_only=True)
|
||||||
|
section = serializers.CharField(required=True, allow_null=False)
|
||||||
|
|
||||||
transaction_status = serializers.ChoiceField(
|
transaction_status = serializers.ChoiceField(
|
||||||
choices=Transaction.TRANSACTION_STATUS_CHOICES)
|
choices=Transaction.TRANSACTION_STATUS_CHOICES)
|
||||||
|
@ -48,7 +49,7 @@ class TransactionSerializer(serializers.HyperlinkedModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Transaction
|
model = Transaction
|
||||||
fields = ['id', 'borrower', 'teacher', 'subject',
|
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']
|
read_only_fields = ['id', 'timestamp']
|
||||||
|
|
||||||
def to_representation(self, instance):
|
def to_representation(self, instance):
|
||||||
|
|
Loading…
Reference in a new issue