-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #488 from ucdavis/swe/NotifyAPI
Add Notify API
- Loading branch information
Showing
37 changed files
with
207 additions
and
98 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
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel.DataAnnotations; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Text.Json.Serialization; | ||
using System.Threading.Tasks; | ||
using Hippo.Core.Validation; | ||
|
||
namespace Hippo.Core.Models.Email | ||
{ | ||
public class SimpleNotificationModel | ||
{ | ||
[Required] | ||
[ListOfEmailAddress] | ||
public string[] Emails { get; set; } = Array.Empty<string>(); | ||
[Required] | ||
[ListOfEmailAddress] | ||
public string[] CcEmails { get; set; } = Array.Empty<string>(); | ||
[Required] | ||
public string Subject { get; set; } = ""; | ||
public string Header { get; set; } = ""; | ||
[Required] | ||
public List<string> Paragraphs { get; set; } = new(); | ||
[JsonIgnore] | ||
public string UcdLogoUrl { get; set; } = ""; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace Hippo.Core.Validation; | ||
|
||
/// <summary> | ||
/// Validates that all elements of a list are email addresses | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)] | ||
public class ListOfEmailAddressAttribute : ValidationAttribute | ||
{ | ||
private readonly bool _nonEmpty; | ||
private readonly EmailAddressAttribute _emailAddressAttribute; | ||
|
||
public ListOfEmailAddressAttribute(bool nonEmpty = false) | ||
: base() | ||
{ | ||
_nonEmpty = nonEmpty; | ||
_emailAddressAttribute = new EmailAddressAttribute(); | ||
} | ||
|
||
protected override ValidationResult IsValid(object value, ValidationContext validationContext) | ||
{ | ||
var list = value as IList<string>; | ||
if (_nonEmpty && (list == null || !list.Any())) | ||
return new ValidationResult($"'{validationContext.MemberName}' requires at least 1 email address"); | ||
|
||
if (list == null) | ||
return ValidationResult.Success; | ||
|
||
foreach (var email in list) | ||
{ | ||
if (!_emailAddressAttribute.IsValid(email)) | ||
return new ValidationResult($"'{validationContext.MemberName}' contains an invalid email address."); | ||
} | ||
|
||
return ValidationResult.Success; | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
.../Views/Emails/AccountDecision_mjml.cshtml → .../Views/Emails/AccountDecision_mjml.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
4 changes: 2 additions & 2 deletions
4
...l/Views/Emails/AccountRequest_mjml.cshtml → ...e/Views/Emails/AccountRequest_mjml.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
4 changes: 2 additions & 2 deletions
4
.../Emails/AdminOverrideDecision_mjml.cshtml → .../Emails/AdminOverrideDecision_mjml.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
4 changes: 2 additions & 2 deletions
4
.../Emails/OrderAdminPaymentFail_mjml.cshtml → .../Emails/OrderAdminPaymentFail_mjml.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
4 changes: 2 additions & 2 deletions
4
...iews/Emails/OrderNotification_mjml.cshtml → ...iews/Emails/OrderNotification_mjml.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
4 changes: 2 additions & 2 deletions
4
...ails/OrderPaymentNotification_mjml.cshtml → ...ails/OrderPaymentNotification_mjml.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
4 changes: 2 additions & 2 deletions
4
Hippo.Email/Views/Emails/Sample_mjml.cshtml → Hippo.Core/Views/Emails/Sample_mjml.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
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
2 changes: 1 addition & 1 deletion
2
...ail/Views/Shared/_EmailButton_mjml.cshtml → ...ore/Views/Shared/_EmailButton_mjml.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
2 changes: 1 addition & 1 deletion
2
...ews/Shared/_EmailInnerDetails_mjml.cshtml → ...ews/Shared/_EmailInnerDetails_mjml.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
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.