TF-138 Add domain layer for search mail with text pattern

This commit is contained in:
dab246
2021-10-26 13:17:12 +07:00
committed by Dat H. Pham
parent 03f5921025
commit 62d416c4a4
11 changed files with 254 additions and 4 deletions
@@ -57,6 +57,7 @@ extension EmailExtension on Email {
cc: cc,
bcc: bcc,
replyTo: replyTo,
mailboxIds: mailboxIds,
selectMode: selectMode
);
}
@@ -34,6 +34,8 @@ extension PresentationEmailExtension on PresentationEmail {
cc: cc,
bcc: bcc,
replyTo: replyTo,
mailboxIds: mailboxIds,
mailboxNames: mailboxNames,
selectMode: selectMode == SelectMode.INACTIVE ? SelectMode.ACTIVE : SelectMode.INACTIVE
);
}
@@ -53,6 +55,8 @@ extension PresentationEmailExtension on PresentationEmail {
cc: cc,
bcc: bcc,
replyTo: replyTo,
mailboxIds: mailboxIds,
mailboxNames: mailboxNames,
selectMode: selectMode
);
}
@@ -102,4 +106,37 @@ extension PresentationEmailExtension on PresentationEmail {
return Tuple3([], [], []);
}
}
PresentationEmail toSearchPresentationEmail(Map<MailboxId, PresentationMailbox> mapMailboxes) {
mailboxIds?.removeWhere((key, value) => !value);
final listMailboxId = mailboxIds?.entries
.where((entry) => entry.value)
.map((entry) => entry.key)
.toList();
final listMailboxName = listMailboxId
?.map((mailboxId) => mapMailboxes.containsKey(mailboxId) ? mapMailboxes[mailboxId]?.name : null)
.where((mailboxName) => mailboxName != null)
.toList();
return PresentationEmail(
this.id,
keywords: keywords,
size: size,
receivedAt: receivedAt,
hasAttachment: hasAttachment,
preview: preview,
subject: subject,
sentAt: sentAt,
from: from,
to: to,
cc: cc,
bcc: bcc,
replyTo: replyTo,
mailboxIds: mailboxIds,
mailboxNames: listMailboxName,
selectMode: selectMode
);
}
}