mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-07-16 17:47:22 +00:00
Format ./web/backend/Infrastructure/Infrastructure.Email.Templates
This commit is contained in:
@@ -6,21 +6,15 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<SupportedPlatform Include="browser"/>
|
<SupportedPlatform Include="browser" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="10.0.1" />
|
||||||
<PackageReference
|
<PackageReference
|
||||||
Include="Microsoft.AspNetCore.Components.Web"
|
Include="Microsoft.Extensions.DependencyInjection.Abstractions"
|
||||||
Version="10.0.1"
|
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>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -14,10 +14,8 @@ namespace Infrastructure.Email.Templates.Rendering;
|
|||||||
/// pipeline.
|
/// pipeline.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="loggerFactory">The logger factory passed to the <see cref="HtmlRenderer" /> used to render components.</param>
|
/// <param name="loggerFactory">The logger factory passed to the <see cref="HtmlRenderer" /> used to render components.</param>
|
||||||
public class EmailTemplateProvider(
|
public class EmailTemplateProvider(IServiceProvider serviceProvider, ILoggerFactory loggerFactory)
|
||||||
IServiceProvider serviceProvider,
|
: IEmailTemplateProvider
|
||||||
ILoggerFactory loggerFactory
|
|
||||||
) : IEmailTemplateProvider
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Renders the UserRegisteredEmail template with the specified parameters.
|
/// Renders the UserRegisteredEmail template with the specified parameters.
|
||||||
@@ -33,7 +31,7 @@ public class EmailTemplateProvider(
|
|||||||
Dictionary<string, object?> parameters = new()
|
Dictionary<string, object?> parameters = new()
|
||||||
{
|
{
|
||||||
{ nameof(UserRegistration.Username), username },
|
{ nameof(UserRegistration.Username), username },
|
||||||
{ nameof(UserRegistration.ConfirmationLink), confirmationLink }
|
{ nameof(UserRegistration.ConfirmationLink), confirmationLink },
|
||||||
};
|
};
|
||||||
|
|
||||||
return await RenderComponentAsync<UserRegistration>(parameters);
|
return await RenderComponentAsync<UserRegistration>(parameters);
|
||||||
@@ -53,7 +51,7 @@ public class EmailTemplateProvider(
|
|||||||
Dictionary<string, object?> parameters = new()
|
Dictionary<string, object?> parameters = new()
|
||||||
{
|
{
|
||||||
{ nameof(ResendConfirmation.Username), username },
|
{ nameof(ResendConfirmation.Username), username },
|
||||||
{ nameof(ResendConfirmation.ConfirmationLink), confirmationLink }
|
{ nameof(ResendConfirmation.ConfirmationLink), confirmationLink },
|
||||||
};
|
};
|
||||||
|
|
||||||
return await RenderComponentAsync<ResendConfirmation>(parameters);
|
return await RenderComponentAsync<ResendConfirmation>(parameters);
|
||||||
@@ -72,10 +70,7 @@ public class EmailTemplateProvider(
|
|||||||
)
|
)
|
||||||
where TComponent : IComponent
|
where TComponent : IComponent
|
||||||
{
|
{
|
||||||
await using HtmlRenderer htmlRenderer = new(
|
await using HtmlRenderer htmlRenderer = new(serviceProvider, loggerFactory);
|
||||||
serviceProvider,
|
|
||||||
loggerFactory
|
|
||||||
);
|
|
||||||
|
|
||||||
string html = await htmlRenderer.Dispatcher.InvokeAsync(async () =>
|
string html = await htmlRenderer.Dispatcher.InvokeAsync(async () =>
|
||||||
{
|
{
|
||||||
@@ -89,4 +84,4 @@ public class EmailTemplateProvider(
|
|||||||
|
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,7 @@ public interface IEmailTemplateProvider
|
|||||||
/// <param name="username">The username to include in the email</param>
|
/// <param name="username">The username to include in the email</param>
|
||||||
/// <param name="confirmationLink">The email confirmation link</param>
|
/// <param name="confirmationLink">The email confirmation link</param>
|
||||||
/// <returns>The rendered HTML string</returns>
|
/// <returns>The rendered HTML string</returns>
|
||||||
Task<string> RenderUserRegisteredEmailAsync(
|
Task<string> RenderUserRegisteredEmailAsync(string username, string confirmationLink);
|
||||||
string username,
|
|
||||||
string confirmationLink
|
|
||||||
);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Renders the ResendConfirmation template with the specified parameters.
|
/// 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="username">The username to include in the email</param>
|
||||||
/// <param name="confirmationLink">The new confirmation link</param>
|
/// <param name="confirmationLink">The new confirmation link</param>
|
||||||
/// <returns>The rendered HTML string</returns>
|
/// <returns>The rendered HTML string</returns>
|
||||||
Task<string> RenderResendConfirmationEmailAsync(
|
Task<string> RenderResendConfirmationEmailAsync(string username, string confirmationLink);
|
||||||
string username,
|
}
|
||||||
string confirmationLink
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user