-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Various renames and fixes.
- Loading branch information
n.bitounis
committed
Jun 1, 2020
1 parent
1bf57ad
commit d111fd3
Showing
35 changed files
with
558 additions
and
95 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
Projects/SesNotifications.App/Factories/DbSesDeliveryEventFactory.cs
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using SesNotifications.App.Models; | ||
using SesDeliveryEvent = SesNotifications.DataAccess.Entities.SesDeliveryEvent; | ||
|
||
namespace SesNotifications.App.Factories | ||
{ | ||
public static class DbSesDeliveryEventFactory | ||
{ | ||
public static SesDeliveryEvent Create(this SesDeliveryEventModel delivery, long notificationId) | ||
{ | ||
return new SesDeliveryEvent | ||
{ | ||
NotificationId = notificationId, | ||
NotificationType = "Delivery", | ||
SentAt = Convert.ToDateTime(delivery.Mail.Timestamp), | ||
MessageId = delivery.Mail.MessageId, | ||
Source = delivery.Mail.Source, | ||
SourceArn = delivery.Mail.SourceArn, | ||
SourceIp = delivery.Mail.SourceIp, | ||
SendingAccountId = delivery.Mail.SendingAccountId, | ||
DeliveredAt = Convert.ToDateTime(delivery.Delivery.Timestamp), | ||
SmtpResponse = delivery.Delivery.SmtpResponse, | ||
ReportingMta = delivery.Delivery.ReportingMta, | ||
Recipients = string.Join(',', delivery.Delivery.Recipients) | ||
}; | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
Projects/SesNotifications.App/Factories/DbSesOpenEventFactory.cs
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using SesNotifications.App.Models; | ||
using SesNotifications.DataAccess.Entities; | ||
using SesOpenEvent = SesNotifications.DataAccess.Entities.SesOpenEvent; | ||
|
||
namespace SesNotifications.App.Factories | ||
{ | ||
public static class DbSesOpenEventFactory | ||
{ | ||
public static SesOpenEvent Create(this SesOpenEventModel openEvent, long notificationId) | ||
{ | ||
return new SesOpenEvent | ||
{ | ||
Id = notificationId, | ||
NotificationId = notificationId, | ||
NotificationType = "Open", | ||
SentAt = Convert.ToDateTime(openEvent.Mail.Timestamp), | ||
MessageId = openEvent.Mail.MessageId, | ||
Source = openEvent.Mail.Source, | ||
SourceArn = openEvent.Mail.SourceArn, | ||
SourceIp = openEvent.Mail.SourceIp, | ||
SendingAccountId = openEvent.Mail.SendingAccountId, | ||
Recipients = string.Join(',', openEvent.Mail.Destination), | ||
OpenedAt = Convert.ToDateTime(openEvent.Open.Timestamp), | ||
UserAgent = openEvent.Open.UserAgent, | ||
IpAddress = openEvent.Open.IpAddress | ||
}; | ||
} | ||
} | ||
} |
29 changes: 0 additions & 29 deletions
29
Projects/SesNotifications.App/Factories/DbSesOpenFactory.cs
This file was deleted.
Oops, something went wrong.
5 changes: 3 additions & 2 deletions
5
...cations.App/Factories/DbSesSendFactory.cs → ...ns.App/Factories/DbSesSendEventFactory.cs
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace SesNotifications.App.Models | ||
{ | ||
public class SesDeliveryEvent | ||
{ | ||
public virtual string Timestamp { get; set; } | ||
public virtual string[] Recipients { get; set; } | ||
public virtual string SmtpResponse { get; set; } | ||
public virtual string ReportingMta { get; set; } | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
Projects/SesNotifications.App/Models/SesDeliveryEventModel.cs
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace SesNotifications.App.Models | ||
{ | ||
public class SesDeliveryEventModel : Ses | ||
{ | ||
public virtual SesMail Mail { get; set; } | ||
public virtual SesDeliveryEvent Delivery { get; set; } | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ts/SesNotifications.App/Models/SesOpen.cs → ...sNotifications.App/Models/SesOpenEvent.cs
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
4 changes: 2 additions & 2 deletions
4
...sNotifications.App/Models/SesSendModel.cs → ...fications.App/Models/SesOpenEventModel.cs
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,8 +1,8 @@ | ||
namespace SesNotifications.App.Models | ||
{ | ||
public class SesSendModel : Ses | ||
public class SesOpenEventModel : Ses | ||
{ | ||
public virtual SesMail Mail { get; set; } | ||
public virtual SesSend Send { get; set; } | ||
public virtual SesOpenEvent Open { get; set; } | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ts/SesNotifications.App/Models/SesSend.cs → ...sNotifications.App/Models/SesSendEvent.cs
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,6 +1,6 @@ | ||
namespace SesNotifications.App.Models | ||
{ | ||
public class SesSend | ||
public class SesSendEvent | ||
{ | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...sNotifications.App/Models/SesOpenModel.cs → ...fications.App/Models/SesSendEventModel.cs
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,8 +1,8 @@ | ||
namespace SesNotifications.App.Models | ||
{ | ||
public class SesOpenModel : Ses | ||
public class SesSendEventModel : Ses | ||
{ | ||
public virtual SesMail Mail { get; set; } | ||
public virtual SesOpen Open { get; set; } | ||
public virtual SesSendEvent Send { get; set; } | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
Projects/SesNotifications.App/Pages/FindDeliveryEvents.cshtml
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
@page | ||
@model SesNotifications.App.Pages.FindDeliveryEventsModel | ||
@{ | ||
ViewData["Title"] = "Find delivery events"; | ||
} | ||
|
||
<!DOCTYPE html> | ||
|
||
<h1>@ViewData["Title"]</h1> | ||
<h4>Search for delivery events by date range and optional recipient.</h4> | ||
<hr /> | ||
<div class="row"> | ||
<div class="col-md-4"> | ||
<form method="post"> | ||
<div asp-validation-summary="All" class="text-danger"></div> | ||
<div class="form-group"> | ||
<label>Starting date</label> | ||
<input asp-for="Input.Start" class="form-control" /> | ||
<span asp-validation-for="Input.Start" class="text-danger"></span> | ||
|
||
<label>Ending date</label> | ||
<input asp-for="Input.End" class="form-control" /> | ||
<span asp-validation-for="Input.End" class="text-danger"></span> | ||
|
||
<label asp-for="Input.Email"></label> | ||
<input asp-for="Input.Email" class="form-control" /> | ||
<span asp-validation-for="Input.Email" class="text-danger"></span> | ||
</div> | ||
|
||
<button type="submit" class="btn btn-primary">Submit</button> | ||
</form> | ||
<br /> | ||
|
||
<table class="table"> | ||
<tr> | ||
<th>ID</th> | ||
<th>Notification ID</th> | ||
<th>Notification Type</th> | ||
<th>Sent at</th> | ||
<th>Message ID</th> | ||
<th>Source</th> | ||
<th>Recipients</th> | ||
<th>Source ARN</th> | ||
<th>Source IP</th> | ||
<th>Sending Account ID</th> | ||
<th>Delivered At</th> | ||
<th>SMTP Response</th> | ||
<th>Reporting MTA</th> | ||
<th>Raw model</th> | ||
<th>Raw message</th> | ||
</tr> | ||
@foreach (var record in Model.DeliveryEvents) | ||
{ | ||
<tr> | ||
<td>@record.Id</td> | ||
<td>@record.NotificationId</td> | ||
<td>@record.NotificationType</td> | ||
<td>@record.SentAt.ToString("yyyy-MM-dd HH:mm:ssZ")</td> | ||
<td>@record.MessageId</td> | ||
<td>@record.Source</td> | ||
<td>@record.Recipients</td> | ||
<td>@record.SourceArn</td> | ||
<td>@record.SourceIp</td> | ||
<td>@record.SendingAccountId</td> | ||
<td>@record.DeliveredAt.ToString("yyyy-MM-dd HH:mm:ssZ")</td> | ||
<td>@record.SmtpResponse</td> | ||
<td>@record.ReportingMta</td> | ||
<td><a target="_blank" href="@Url.Action("FindRawById", "Searches", new {id = record.NotificationId})">RAW (MODEL)</a></td> | ||
<td><a target="_blank" href="@string.Concat(Url.Action("FindMessageById", "Searches", new {id = record.NotificationId}), "/text")">RAW (MESSAGE)</a></td> | ||
</tr> | ||
} | ||
</table> | ||
</div> | ||
</div> |
44 changes: 44 additions & 0 deletions
44
Projects/SesNotifications.App/Pages/FindDeliveryEvents.cshtml.cs
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel.DataAnnotations; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
using SesNotifications.App.Services.Interfaces; | ||
using SesNotifications.DataAccess.Entities; | ||
|
||
namespace SesNotifications.App.Pages | ||
{ | ||
public class FindDeliveryEventsModel : PageModel | ||
{ | ||
[BindProperty] | ||
public InputModel Input { get; set; } | ||
|
||
public IList<SesDeliveryEvent> DeliveryEvents { get; set; } = new List<SesDeliveryEvent>(); | ||
|
||
public class InputModel | ||
{ | ||
[Required] | ||
[DataType(DataType.Date)] | ||
public DateTime Start { get; set; } | ||
|
||
[Required] | ||
[DataType(DataType.Date)] | ||
public DateTime End { get; set; } | ||
|
||
public string Email { get; set; } | ||
} | ||
|
||
private readonly ISearchService _searchService; | ||
|
||
public FindDeliveryEventsModel(ISearchService searchService) | ||
{ | ||
_searchService = searchService; | ||
} | ||
|
||
public IActionResult OnPost() | ||
{ | ||
DeliveryEvents = _searchService.FindDeliveryEvents(Input.Email, Input.Start, Input.End); | ||
return Page(); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.