Fix swagger
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Nashel.BuildingBlocks.Application.Abstractions;
|
||||
using Nashel.BuildingBlocks.Application.Behaviors;
|
||||
using Nashel.Modules.Identity.Application.Commands;
|
||||
using Nashel.Modules.Identity.Domain.Repositories;
|
||||
using Nashel.Modules.Identity.Domain.Services;
|
||||
using Nashel.Modules.Identity.Infrastructure.Persistence;
|
||||
using Nashel.Modules.Identity.Infrastructure.Repositories;
|
||||
using Nashel.Modules.Identity.Infrastructure.Services;
|
||||
using Nashel.Modules.Identity.Application.Commands;
|
||||
|
||||
namespace Nashel.Modules.Identity.Infrastructure;
|
||||
|
||||
@@ -19,27 +20,18 @@ public static class DependencyInjection
|
||||
services.AddScoped<IAccountRepository, AccountRepository>();
|
||||
services.AddScoped<IJwtTokenGenerator, JwtTokenGenerator>();
|
||||
services.AddScoped<ICurrentUserService, CurrentUserService>();
|
||||
services.AddHttpContextAccessor(); // Ensure available
|
||||
services.AddHttpContextAccessor();
|
||||
|
||||
// Add MediatR (auto-scan for handlers in Application layer)
|
||||
services.AddMediatR(cfg =>
|
||||
{
|
||||
cfg.RegisterServicesFromAssembly(typeof(RegisterUserCommand).Assembly);
|
||||
cfg.AddBehavior(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>));
|
||||
});
|
||||
|
||||
// Add DbContext
|
||||
services.AddDbContext<IdentityDbContext>(options =>
|
||||
// Configure PostgreSQL inside Host or pass options builder
|
||||
// Assume Host configures DbContext options or use connection string here
|
||||
// If "NativeAOT" -> Npgsql DataSource approach is preferred in Host Program.cs.
|
||||
// But standard AddDbContext works too for now.
|
||||
// Let's assume connection string is provided in configuration or options.
|
||||
// For now, simple AddDbContext
|
||||
{
|
||||
// options.UseNpgsql(configuration.GetConnectionString("DefaultConnection"));
|
||||
// This requires Microsoft.EntityFrameworkCore.Npgsql package in Infrastructure.
|
||||
});
|
||||
{
|
||||
options.UseNpgsql(configuration.GetConnectionString("DefaultConnection"));
|
||||
});
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user