Added properties to easy filter emails and attachments
This commit is contained in:
parent
8e461b43a5
commit
c516969cb0
|
@ -34,5 +34,12 @@ class Email(
|
|||
) {
|
||||
val plainTextOrHtmlBody: String? by lazy { plainTextBody ?: htmlBody }
|
||||
|
||||
val hasAttachments: Boolean by lazy { attachments.isNotEmpty() }
|
||||
|
||||
val hasEInvoiceAttachment: Boolean by lazy { attachments.any { it.containsEInvoice } }
|
||||
|
||||
val hasPdfAttachment: Boolean by lazy { attachments.any { it.isPdfFile } }
|
||||
|
||||
|
||||
override fun toString() = "${date.atZone(ZoneId.systemDefault()).toLocalDate()} $sender: $subject, ${attachments.size} attachment(s)"
|
||||
}
|
|
@ -18,5 +18,9 @@ class EmailAttachment(
|
|||
val invoice: Invoice? = null,
|
||||
val file: File? = null
|
||||
) {
|
||||
val containsEInvoice: Boolean by lazy { invoice != null }
|
||||
|
||||
val isPdfFile: Boolean by lazy { extension == "pdf" || mediaType == "application/pdf" }
|
||||
|
||||
override fun toString() = "$filename: $invoice"
|
||||
}
|
Loading…
Reference in New Issue