Skip to content

Commit

Permalink
fix: Erreurs de serialisation des inbound email (#1619)
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilouf authored Dec 31, 2024
1 parent e33ed12 commit 987b044
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lemarche/api/emails/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,26 @@ class UserInboundParsingSerializer(serializers.DictField):


class EmailItemSerializer(serializers.Serializer):
"""Email ItemSerializer for data comes from Brevo"""
"""Email ItemSerializer for data comes from Brevo
https://developers.brevo.com/docs/inbound-parse-webhooks#parsed-email-payload
"""

Uuid = serializers.ListField(child=serializers.UUIDField())
MessageId = serializers.CharField()
InReplyTo = serializers.CharField(required=False, allow_null=True)
InReplyTo = serializers.CharField(required=False, allow_null=True, allow_blank=True)
From = UserInboundParsingSerializer()
To = serializers.ListField(child=UserInboundParsingSerializer())
Cc = serializers.ListField(child=UserInboundParsingSerializer(), required=False)
ReplyTo = serializers.CharField(required=False, allow_null=True)
ReplyTo = serializers.CharField(required=False, allow_null=True, allow_blank=True)
SentAtDate = serializers.CharField()
Subject = serializers.CharField(required=False, allow_null=True)
RawHtmlBody = serializers.CharField(required=False, allow_null=True)
RawTextBody = serializers.CharField(required=False, allow_null=True)
RawHtmlBody = serializers.CharField(required=False, allow_null=True, allow_blank=True)
RawTextBody = serializers.CharField(required=False, allow_null=True, allow_blank=True)
ExtractedMarkdownMessage = serializers.CharField(required=False, allow_null=True)
ExtractedMarkdownSignature = serializers.CharField(required=False, allow_null=True)
SpamScore = serializers.FloatField()
ExtractedMarkdownSignature = serializers.CharField(required=False, allow_null=True, allow_blank=True)
SpamScore = serializers.FloatField(required=False)
Attachments = serializers.ListField(child=serializers.DictField(), required=False)
Headers = serializers.DictField()
Headers = serializers.DictField(required=False)


class EmailsSerializer(serializers.Serializer):
Expand Down

0 comments on commit 987b044

Please sign in to comment.