✨(api) add draftBody

This commit is contained in:
Sabrina Demagny
2025-04-30 22:06:29 +02:00
committed by Jean-Baptiste PENRATH
parent 9d72a787b7
commit 3df94cd80f
3 changed files with 26 additions and 4 deletions
+6 -4
View File
@@ -690,8 +690,7 @@ class DraftMessageView(APIView):
- parentId: str (optional, message id if reply, None if first message)
- senderId: str (mailbox id of the sender)
- subject: str
- htmlBody: str (optional)
- textBody: str (optional)
- draftBody: str (optional)
- to: list[str] (optional)
- cc: list[str] (optional)
- bcc: list[str] (optional)
@@ -699,8 +698,7 @@ class DraftMessageView(APIView):
PUT /api/v1.0/draft/{message_id}/ with expected data:
- subject: str (optional)
- htmlBody: str (optional)
- textBody: str (optional)
- draftBody: str (optional)
- to: list[str] (optional)
- cc: list[str] (optional)
- bcc: list[str] (optional)
@@ -995,6 +993,10 @@ class SendMessageView(APIView):
POST /api/v1.0/send/ with expected data:
- messageId: str (ID of the draft message to send)
- senderId: str (ID of the mailbox to use as sender)
- draftBody: str (optional)
- to: list[str] (optional)
- cc: list[str] (optional)
- bcc: list[str] (optional)
Return the sent message
"""
@@ -0,0 +1,18 @@
# Generated by Django 5.1.8 on 2025-04-28 02:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0004_message_is_draft'),
]
operations = [
migrations.AddField(
model_name='message',
name='draft_body',
field=models.TextField(blank=True, verbose_name='draft body'),
),
]
+2
View File
@@ -368,6 +368,8 @@ class Message(BaseModel):
# to object storage in the future.
raw_mime = models.BinaryField(blank=True, default=b"")
draft_body = models.TextField(_("draft body"), blank=True)
# Internal cache for parsed data
_parsed_email_cache: Optional[Dict[str, Any]] = None