Skip to content

Commit

Permalink
Import Info Serializer #384 (#455)
Browse files Browse the repository at this point in the history
* ImportInfo Serializer
* PortOfEntry serializer

---------

Co-authored-by: rahulrameshan <rahulrameshan@qburst.com>
  • Loading branch information
tishiljk3 and rahulrameshan authored Apr 28, 2023
1 parent 6d32da8 commit 9fd4874
Showing 1 changed file with 51 additions and 1 deletion.
52 changes: 51 additions & 1 deletion server/apps/trak/serializers/manifest_ser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
from rest_framework import serializers

from apps.trak.models import Manifest
from apps.trak.models.manifest_models import AdditionalInfo
from apps.trak.models.manifest_models import AdditionalInfo, ImportInfo, PortOfEntry
from apps.trak.serializers.handler_ser import HandlerSerializer
from apps.sites.models import RcraStates

from .base_ser import TrakBaseSerializer
from .handler_ser import TransporterSerializer
Expand Down Expand Up @@ -269,3 +270,52 @@ class Meta:
"locked",
"lockReason",
]


class PortOfEntrySerializer(TrakBaseSerializer):
"""
Serializer for Port Of Entry
"""

state = serializers.ChoiceField(
choices=RcraStates.choices,
required=False,
allow_null=True,
)

cityPort = serializers.CharField(
source = 'city_port',
required=False,
allow_null=True,
)

class Meta:
model = PortOfEntry
fields = [
'state',
'cityPort'
]


class ImportInfoSerializer(TrakBaseSerializer):
"""
Serializer for import information
"""

importGenerator = serializers.JSONField(
source="import_generator",
allow_null=True,
required=False,
)
portOfEntry = PortOfEntrySerializer(
source="port_of_entry",
required=False,
allow_null=True,
)

class Meta:
model = ImportInfo
fields = [
'importGenerator',
'PortOfEntry'
]

0 comments on commit 9fd4874

Please sign in to comment.