Interface IMailAccountAssignments
- Namespace
- MailFathom.Application.Accounts
- Assembly
- MailFathom.Application.dll
Answers which mail accounts one user is assigned.
public interface IMailAccountAssignments
Remarks
An account is a record of its own and is assigned to however many users an administrator assigned it to, so which user reaches which mailbox is a relation rather than a column on either side. This is the one port that reads it, and the two directions have different callers. Every answer is read from the relation as it stands, so an assignment an administrator just made or withdrew is the answer the next question gets on every replica.
Two read the user-to-accounts direction, and no third joins them without a reason of the same kind. AssignedMailAccountCatalog is what every resolution over stored mail narrows through, so a use case reading mail never asks the relation itself. ContactBookScopes is the second, because the contact books a user reads are their own beside the collected book of each account assigned to them, which is a set of books rather than a set of mailboxes and is therefore not a question the catalog answers.
The account-to-users direction is read by the work that has a mailbox in hand and needs the people it serves: the per-user ceilings fan out over it — EmbeddingSpendGate and AttachmentDerivationSpendGate — and a signal raised about an account is fanned out to them.
It answers about the account or the user it is asked about rather than about the caller, which is why it is not itself a caller-scoped port. A read model reaching the user direction of it is therefore free to ask about somebody else, and something above it has to bind the question to the user the work in hand is acting for: the catalog for mail, and ContactBookOwnership for the books, which resolves the user from the principal and refuses a caller acting for nobody before a scope is composed at all.
Methods
- ReadAccountsAssignedToAsync(UserId, CancellationToken)
Reads the accounts one user is assigned, or empty when they are assigned none.
- ReadUsersAssignedToAsync(MailAccountId, CancellationToken)
Reads the users one account is assigned to, or empty when it is assigned to nobody.