summaryrefslogtreecommitdiff
path: root/service/pixelated/adapter/draft_service.py
blob: d9d6b12fac749e42274f937f3adef2f630ced678 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19


class DraftService(object):
    __slots__ = '_mailboxes'

    def __init__(self, mailboxes):
        self._mailboxes = mailboxes

    def create_draft(self, input_mail):
        self._drafts().add(input_mail)
        return input_mail

    def update_draft(self, ident, input_mail):
        new_mail = self.create_draft(input_mail)
        self._drafts().remove(ident)
        return new_mail

    def _drafts(self):
        return self._mailboxes.drafts()