-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored all domain events into a shared library
- Loading branch information
1 parent
bdcff40
commit 23d3cce
Showing
135 changed files
with
1,818 additions
and
1,583 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,152 +1,87 @@ | ||
using Common; | ||
using Domain.Common.ValueObjects; | ||
using Domain.Interfaces.Entities; | ||
using Domain.Events.Shared.Ancillary.EmailDelivery; | ||
using Created = Domain.Events.Shared.Ancillary.Audits.Created; | ||
|
||
namespace AncillaryDomain; | ||
|
||
public static class Events | ||
{ | ||
public static class EmailDelivery | ||
{ | ||
public sealed class Created : IDomainEvent | ||
public static Domain.Events.Shared.Ancillary.EmailDelivery.Created Created(Identifier id, | ||
QueuedMessageId messageId) | ||
{ | ||
public static Created Create(Identifier id, QueuedMessageId messageId) | ||
return new Domain.Events.Shared.Ancillary.EmailDelivery.Created | ||
{ | ||
return new Created | ||
{ | ||
RootId = id, | ||
OccurredUtc = DateTime.UtcNow, | ||
MessageId = messageId | ||
}; | ||
} | ||
|
||
public required string MessageId { get; set; } | ||
|
||
public required string RootId { get; set; } | ||
|
||
public required DateTime OccurredUtc { get; set; } | ||
RootId = id, | ||
OccurredUtc = DateTime.UtcNow, | ||
MessageId = messageId | ||
}; | ||
} | ||
|
||
public sealed class EmailDetailsChanged : IDomainEvent | ||
public static DeliveryAttempted DeliveryAttempted(Identifier id, DateTime when) | ||
{ | ||
public static EmailDetailsChanged Create(Identifier id, string subject, string body, EmailRecipient to) | ||
return new DeliveryAttempted | ||
{ | ||
return new EmailDetailsChanged | ||
{ | ||
RootId = id, | ||
OccurredUtc = DateTime.UtcNow, | ||
Subject = subject, | ||
Body = body, | ||
ToEmailAddress = to.EmailAddress, | ||
ToDisplayName = to.DisplayName | ||
}; | ||
} | ||
|
||
public required string Body { get; set; } | ||
|
||
public required string Subject { get; set; } | ||
|
||
public required string ToDisplayName { get; set; } | ||
|
||
public required string ToEmailAddress { get; set; } | ||
|
||
public required string RootId { get; set; } | ||
|
||
public required DateTime OccurredUtc { get; set; } | ||
RootId = id, | ||
OccurredUtc = DateTime.UtcNow, | ||
When = when | ||
}; | ||
} | ||
|
||
public sealed class DeliveryAttempted : IDomainEvent | ||
public static DeliveryFailed DeliveryFailed(Identifier id, DateTime when) | ||
{ | ||
public static DeliveryAttempted Create(Identifier id, DateTime when) | ||
return new DeliveryFailed | ||
{ | ||
return new DeliveryAttempted | ||
{ | ||
RootId = id, | ||
OccurredUtc = DateTime.UtcNow, | ||
When = when | ||
}; | ||
} | ||
|
||
public required DateTime When { get; set; } | ||
|
||
public required DateTime OccurredUtc { get; set; } | ||
|
||
public required string RootId { get; set; } | ||
RootId = id, | ||
OccurredUtc = DateTime.UtcNow, | ||
When = when | ||
}; | ||
} | ||
|
||
public sealed class DeliveryFailed : IDomainEvent | ||
public static DeliverySucceeded DeliverySucceeded(Identifier id, DateTime when) | ||
{ | ||
public static DeliveryFailed Create(Identifier id, DateTime when) | ||
return new DeliverySucceeded | ||
{ | ||
return new DeliveryFailed | ||
{ | ||
RootId = id, | ||
OccurredUtc = DateTime.UtcNow, | ||
When = when | ||
}; | ||
} | ||
|
||
public required DateTime When { get; set; } | ||
|
||
public required DateTime OccurredUtc { get; set; } | ||
|
||
public required string RootId { get; set; } | ||
RootId = id, | ||
OccurredUtc = DateTime.UtcNow, | ||
When = when | ||
}; | ||
} | ||
|
||
public sealed class DeliverySucceeded : IDomainEvent | ||
public static EmailDetailsChanged EmailDetailsChanged(Identifier id, string subject, string body, | ||
EmailRecipient to) | ||
{ | ||
public static DeliverySucceeded Create(Identifier id, DateTime when) | ||
return new EmailDetailsChanged | ||
{ | ||
return new DeliverySucceeded | ||
{ | ||
RootId = id, | ||
OccurredUtc = DateTime.UtcNow, | ||
When = when | ||
}; | ||
} | ||
|
||
public required DateTime When { get; set; } | ||
|
||
public required DateTime OccurredUtc { get; set; } | ||
|
||
public required string RootId { get; set; } | ||
RootId = id, | ||
OccurredUtc = DateTime.UtcNow, | ||
Subject = subject, | ||
Body = body, | ||
ToEmailAddress = to.EmailAddress, | ||
ToDisplayName = to.DisplayName | ||
}; | ||
} | ||
} | ||
|
||
public static class Audits | ||
{ | ||
public sealed class Created : IDomainEvent | ||
public static Created Created(Identifier id, Identifier againstId, Optional<Identifier> organizationId, | ||
string auditCode, Optional<string> messageTemplate, TemplateArguments templateArguments) | ||
{ | ||
public static Created Create(Identifier id, Identifier againstId, Optional<Identifier> organizationId, | ||
string auditCode, Optional<string> messageTemplate, TemplateArguments templateArguments) | ||
return new Created | ||
{ | ||
return new Created | ||
{ | ||
RootId = id, | ||
OccurredUtc = DateTime.UtcNow, | ||
OrganizationId = organizationId.HasValue | ||
? organizationId.Value.Text | ||
: null, | ||
AgainstId = againstId, | ||
AuditCode = auditCode, | ||
MessageTemplate = messageTemplate.ValueOrDefault ?? string.Empty, | ||
TemplateArguments = templateArguments.Items | ||
}; | ||
} | ||
|
||
public required string AgainstId { get; set; } | ||
|
||
public required string AuditCode { get; set; } | ||
|
||
public required string MessageTemplate { get; set; } | ||
|
||
public string? OrganizationId { get; set; } | ||
|
||
public required List<string> TemplateArguments { get; set; } | ||
|
||
public required string RootId { get; set; } | ||
|
||
public required DateTime OccurredUtc { get; set; } | ||
RootId = id, | ||
OccurredUtc = DateTime.UtcNow, | ||
OrganizationId = organizationId.HasValue | ||
? organizationId.Value.Text | ||
: null, | ||
AgainstId = againstId, | ||
AuditCode = auditCode, | ||
MessageTemplate = messageTemplate.ValueOrDefault ?? string.Empty, | ||
TemplateArguments = templateArguments.Items | ||
}; | ||
} | ||
} | ||
} |
Oops, something went wrong.