+ Memberships
- DDD
- FutureCreator
- UserTransactions
This commit is contained in:
2024-10-20 14:01:58 -04:00
parent 3d10427821
commit 28d74503df
117 changed files with 2149 additions and 1999 deletions

View File

@@ -1,10 +1,7 @@
using Hutopy.Application.Common.Interfaces;
using Hutopy.Domain.Constants;
using Hutopy.Domain.Constants;
using Hutopy.Infrastructure.AzureBlob;
using Hutopy.Infrastructure.Data;
using Hutopy.Infrastructure.Data.Interceptors;
using Hutopy.Infrastructure.Identity;
using Hutopy.Infrastructure.Stripe;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
@@ -23,17 +20,12 @@ public static class DependencyInjection
var connectionString = configuration.GetConnectionString("MssqlConnection")
?? throw new InvalidOperationException("Missing ConnectionStrings:MssqlConnection");
services.AddScoped<ISaveChangesInterceptor, AuditableEntityInterceptor>();
services.AddScoped<ISaveChangesInterceptor, DispatchDomainEventsInterceptor>();
services.AddDbContext<ApplicationDbContext>((sp, options) =>
{
options.AddInterceptors(sp.GetServices<ISaveChangesInterceptor>());
options.UseSqlServer(connectionString);
});
services.AddScoped<IApplicationDbContext>(provider => provider.GetRequiredService<ApplicationDbContext>());
services.AddScoped<ApplicationDbContextInitializer>();
services.AddAuthentication()
@@ -52,14 +44,11 @@ public static class DependencyInjection
// Singleton services
services.AddSingleton(TimeProvider.System);
services.AddSingleton<IBlobStorage, AzureBlobStorage>();
services.AddSingleton<AzureBlobStorage>();
// Scoped services
services.AddScoped<IIdentityService, IdentityService>();
services.AddScoped<IdentityService>();
// Transient services
services.AddTransient<IStripeService, StripeService>();
services.AddAuthorization(options =>
options.AddPolicy(Policies.CanPurge, policy => policy.RequireRole(Roles.Administrator)));