Format ./web/backend/Infrastructure/Infrastructure.Email.Templates

This commit is contained in:
Aaron Po
2026-06-20 15:13:01 -04:00
parent 2f28ac9350
commit 744d4c7f8c
3 changed files with 14 additions and 31 deletions

View File

@@ -10,17 +10,11 @@
</ItemGroup>
<ItemGroup>
<PackageReference
Include="Microsoft.AspNetCore.Components.Web"
Version="10.0.1"
/>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="10.0.1" />
<PackageReference
Include="Microsoft.Extensions.DependencyInjection.Abstractions"
Version="10.0.1"
/>
<PackageReference
Include="Microsoft.Extensions.Logging.Abstractions"
Version="10.0.1"
/>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.1" />
</ItemGroup>
</Project>

View File

@@ -14,10 +14,8 @@ namespace Infrastructure.Email.Templates.Rendering;
/// pipeline.
/// </param>
/// <param name="loggerFactory">The logger factory passed to the <see cref="HtmlRenderer" /> used to render components.</param>
public class EmailTemplateProvider(
IServiceProvider serviceProvider,
ILoggerFactory loggerFactory
) : IEmailTemplateProvider
public class EmailTemplateProvider(IServiceProvider serviceProvider, ILoggerFactory loggerFactory)
: IEmailTemplateProvider
{
/// <summary>
/// Renders the UserRegisteredEmail template with the specified parameters.
@@ -33,7 +31,7 @@ public class EmailTemplateProvider(
Dictionary<string, object?> parameters = new()
{
{ nameof(UserRegistration.Username), username },
{ nameof(UserRegistration.ConfirmationLink), confirmationLink }
{ nameof(UserRegistration.ConfirmationLink), confirmationLink },
};
return await RenderComponentAsync<UserRegistration>(parameters);
@@ -53,7 +51,7 @@ public class EmailTemplateProvider(
Dictionary<string, object?> parameters = new()
{
{ nameof(ResendConfirmation.Username), username },
{ nameof(ResendConfirmation.ConfirmationLink), confirmationLink }
{ nameof(ResendConfirmation.ConfirmationLink), confirmationLink },
};
return await RenderComponentAsync<ResendConfirmation>(parameters);
@@ -72,10 +70,7 @@ public class EmailTemplateProvider(
)
where TComponent : IComponent
{
await using HtmlRenderer htmlRenderer = new(
serviceProvider,
loggerFactory
);
await using HtmlRenderer htmlRenderer = new(serviceProvider, loggerFactory);
string html = await htmlRenderer.Dispatcher.InvokeAsync(async () =>
{

View File

@@ -11,10 +11,7 @@ public interface IEmailTemplateProvider
/// <param name="username">The username to include in the email</param>
/// <param name="confirmationLink">The email confirmation link</param>
/// <returns>The rendered HTML string</returns>
Task<string> RenderUserRegisteredEmailAsync(
string username,
string confirmationLink
);
Task<string> RenderUserRegisteredEmailAsync(string username, string confirmationLink);
/// <summary>
/// Renders the ResendConfirmation template with the specified parameters.
@@ -22,8 +19,5 @@ public interface IEmailTemplateProvider
/// <param name="username">The username to include in the email</param>
/// <param name="confirmationLink">The new confirmation link</param>
/// <returns>The rendered HTML string</returns>
Task<string> RenderResendConfirmationEmailAsync(
string username,
string confirmationLink
);
Task<string> RenderResendConfirmationEmailAsync(string username, string confirmationLink);
}