Table of Contents

Class UserMailCollection

Namespace
Tharga.Team.MongoDB
Assembly
Tharga.Team.MongoDB.dll

Queued mail to users, default collection name UserMail.

public class UserMailCollection : DiskRepositoryCollectionBase<UserMailEntity>, IUserMailCollection, IDiskRepositoryCollection<UserMailEntity>, IDiskRepositoryCollection<UserMailEntity, ObjectId>, IRepositoryCollection<UserMailEntity, ObjectId>, IReadOnlyRepositoryCollection<UserMailEntity, ObjectId>, IRepositoryCollection, IReadOnlyRepositoryCollection
Inheritance
RepositoryCollectionBase
RepositoryCollectionBase<UserMailEntity, ObjectId>
DiskRepositoryCollectionBase<UserMailEntity, ObjectId>
DiskRepositoryCollectionBase<UserMailEntity>
UserMailCollection
Implements
IDiskRepositoryCollection<UserMailEntity>
IDiskRepositoryCollection<UserMailEntity, ObjectId>
IRepositoryCollection<UserMailEntity, ObjectId>
IReadOnlyRepositoryCollection<UserMailEntity, ObjectId>
IRepositoryCollection
IReadOnlyRepositoryCollection
Inherited Members
DiskRepositoryCollectionBase<UserMailEntity, ObjectId>.GetCollection()
DiskRepositoryCollectionBase<UserMailEntity, ObjectId>.DropCollectionAsync()
DiskRepositoryCollectionBase<UserMailEntity, ObjectId>.GetDirtyAsync()
DiskRepositoryCollectionBase<UserMailEntity, ObjectId>.GetFailedIndices()
DiskRepositoryCollectionBase<UserMailEntity, ObjectId>.DropEmptyAsync(IMongoCollection<UserMailEntity>)
DiskRepositoryCollectionBase<UserMailEntity, ObjectId>.FetchSize
RepositoryCollectionBase<UserMailEntity, ObjectId>._mongoDbServiceFactory
RepositoryCollectionBase<UserMailEntity, ObjectId>._logger
RepositoryCollectionBase<UserMailEntity, ObjectId>._databaseContext
RepositoryCollectionBase<UserMailEntity, ObjectId>._mongoDbService
RepositoryCollectionBase<UserMailEntity, ObjectId>.InitAsync(IMongoCollection<UserMailEntity>)
RepositoryCollectionBase<UserMailEntity, ObjectId>.ProtectedCollectionName
RepositoryCollectionBase<UserMailEntity, ObjectId>.CollectionName
RepositoryCollectionBase<UserMailEntity, ObjectId>.DatabasePart
RepositoryCollectionBase<UserMailEntity, ObjectId>.ConfigurationName
RepositoryCollectionBase<UserMailEntity, ObjectId>.AutoClean
RepositoryCollectionBase<UserMailEntity, ObjectId>.CleanOnStartup
RepositoryCollectionBase<UserMailEntity, ObjectId>.CreateCollectionStrategy
RepositoryCollectionBase<UserMailEntity, ObjectId>.Indices
RepositoryCollectionBase<UserMailEntity, ObjectId>.CoreIndices
RepositoryCollectionBase<UserMailEntity, ObjectId>.Types
RepositoryCollectionBase.ConfigurationName
RepositoryCollectionBase.ActionEvent

Remarks

Due mail is found by status and due time; a deduplication key is unique where one was given; a batch's mail by its batch and status; a user's history by their key or address, newest first; the mail about a team by the team, newest first, the rest of the global log being read newest first by id; a sent mail by the Message-ID a bounce report names; how often each category was sent by status, completion, category and recipient, read from the index alone, and how often each contact category was by kind, status, completion, category and address, read from an index of its own; and a mail that is done expires after UserMailRetention, while a queued one never does.

Constructors

UserMailCollection(IMongoDbServiceFactory, ILogger<UserMailCollection>, IOptions<ThargaTeamOptions>)

Creates the collection under the configured name and retention.

public UserMailCollection(IMongoDbServiceFactory mongoDbServiceFactory, ILogger<UserMailCollection> logger, IOptions<ThargaTeamOptions> options = null)

Parameters

mongoDbServiceFactory IMongoDbServiceFactory
logger ILogger<UserMailCollection>
options IOptions<ThargaTeamOptions>

Properties

CollectionName

public override string CollectionName { get; }

Property Value

string

Indices

public override IEnumerable<CreateIndexModel<UserMailEntity>> Indices { get; }

Property Value

IEnumerable<CreateIndexModel<UserMailEntity>>

Retention

How long a mail is kept once it is done.

public TimeSpan Retention { get; }

Property Value

TimeSpan

Methods

CountSentByCategoryAsync(DateTime, CancellationToken)

For each category, the mails sent or bounced to a user since since, and to how many users, in one aggregation on the server.

public Task<IReadOnlyList<UserMailCategorySent>> CountSentByCategoryAsync(DateTime since, CancellationToken cancellationToken = default)

Parameters

since DateTime
cancellationToken CancellationToken

Returns

Task<IReadOnlyList<UserMailCategorySent>>

CountSentToContactsByCategoryAsync(DateTime, CancellationToken)

For each contact category, the contact mails sent or bounced since since, and to how many distinct addresses, in one aggregation on the server.

public Task<IReadOnlyList<UserMailCategorySent>> CountSentToContactsByCategoryAsync(DateTime since, CancellationToken cancellationToken = default)

Parameters

since DateTime
cancellationToken CancellationToken

Returns

Task<IReadOnlyList<UserMailCategorySent>>