Skip to content

Commit

Permalink
Add layout and render body component (#12)
Browse files Browse the repository at this point in the history
* Add layout and render body component

* Fix button UI
  • Loading branch information
MysticFragilist authored Feb 29, 2024
1 parent fe62a71 commit 0199953
Show file tree
Hide file tree
Showing 11 changed files with 455 additions and 250 deletions.
14 changes: 10 additions & 4 deletions core/Controllers/MailTestController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@ public async Task<IActionResult> Create()
var result = await service.SendEmailAsync(
"test recipient",
"test subject",
new HelloWorldModel
new StatusChangeModel
{
Title = "Hello World",
Name = "Test name"
Title = "Changement de status",
Salutation = "Bonjour ApplETS,",
StatusHeaderText = "La publication « Compétition de développement mobile » a été",
StatusNameText = "refusée",
StatusRefusalHeader = "Raison du refus :",
StatusRefusalReason = "La publication ne respecte pas les règles de publication",
ButtonSeePublicationText = "Voir la publication",
ButtonLink = new Uri("https://github.com/ApplETS/Backend-Hello/compare/ftr/first-email-and-layout?expand=1"),
},
emails.EmailsUtils.ComplexHelloWorldTemplate);
emails.EmailsUtils.StatusChangeTemplate);

return Ok();
}
Expand Down
1 change: 1 addition & 0 deletions core/Data/Responses/EventResponseDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class EventResponseDTO
public DateTime PublicationDate { get; set; }

public DateTime EventStartDate { get; set; }

public DateTime EventEndDate { get; set; }

public DateTime CreatedAt { get; set; }
Expand Down
3 changes: 1 addition & 2 deletions emails/EmailsUtils.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
namespace api.emails;
public static class EmailsUtils
{
public const string HelloWorldTemplate = "HelloWorld.cshtml";
public const string ComplexHelloWorldTemplate = "ComplexHelloWorld.cshtml";
public const string StatusChangeTemplate = "StatusChange.cshtml";

internal static readonly string TemplateEmbeddedResourceNamespace = "api.emails.Views.";
}
6 changes: 0 additions & 6 deletions emails/Models/HelloWorldModel.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

namespace api.emails.Models;

public class EmailBaseModel
public class LayoutEmailBaseModel
{
public string Title { get; set; }

Check warning on line 6 in emails/Models/LayoutEmailBaseModel.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Title' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
}
38 changes: 38 additions & 0 deletions emails/Models/StatusChangeModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

namespace api.emails.Models;

public class StatusChangeModel : LayoutEmailBaseModel
{
/// <summary>
/// Example: "Dear ACCOUNT_NAME,"
/// </summary>
public string Salutation { get; set; }

Check warning on line 9 in emails/Models/StatusChangeModel.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Salutation' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

/// <summary>
/// Example "The post « POST_NAME » was placed in the status of "
/// </summary>
public string StatusHeaderText { get; set; }

Check warning on line 14 in emails/Models/StatusChangeModel.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'StatusHeaderText' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

/// <summary>
/// Example: "refused"
/// </summary>
public string StatusNameText { get; set; }

Check warning on line 19 in emails/Models/StatusChangeModel.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'StatusNameText' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

/// <summary>
/// if null should not render the refusal reason
/// </summary>
public string? StatusRefusalReason { get; set; }

/// <summary>
/// Example "Reason for refusal :"
/// </summary>
public string StatusRefusalHeader { get; set; }

Check warning on line 29 in emails/Models/StatusChangeModel.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'StatusRefusalHeader' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.


/// <summary>
/// Example "See publication"
/// </summary>
public string ButtonSeePublicationText { get; set; }

Check warning on line 35 in emails/Models/StatusChangeModel.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'ButtonSeePublicationText' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

public Uri ButtonLink { get; set; }

Check warning on line 37 in emails/Models/StatusChangeModel.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'ButtonLink' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
}
40 changes: 0 additions & 40 deletions emails/Views/ComplexHelloWorld.cshtml

This file was deleted.

1 change: 0 additions & 1 deletion emails/Views/HelloWorld.cshtml

This file was deleted.

Loading

0 comments on commit 0199953

Please sign in to comment.