Update SurveyLib and moved all AddScoped to DI methods

This commit is contained in:
Вячеслав 2025-05-31 01:32:50 +05:00
parent d73e0a104f
commit 7ccf8cb018
4 changed files with 49 additions and 20 deletions

View file

@ -8,6 +8,7 @@ using SurveyBackend.Core.Contexts;
using SurveyBackend.Core.Repositories;
using SurveyBackend.Core.Services;
using SurveyBackend.Filters;
using SurveyBackend.Infrastructure;
using SurveyBackend.Infrastructure.Data;
using SurveyBackend.Infrastructure.Repositories;
using SurveyBackend.Middlewares;
@ -16,6 +17,7 @@ using SurveyBackend.Services.Helpers;
using SurveyBackend.Services.Services;
using SurveyLib.Core.Repositories;
using SurveyLib.Core.Services;
using SurveyLib.Infrastructure.EFCore;
using SurveyLib.Infrastructure.EFCore.Data;
using SurveyLib.Infrastructure.EFCore.Repositories;
@ -40,25 +42,9 @@ public class Program
builder.Services.AddScoped<IUserContext, UserContext>();
builder.Services.AddScoped<IUserRepository, UserRepository>();
builder.Services.AddScoped<IUserService, UserService>();
builder.Services.AddScoped<IPasswordHasher, Sha256PasswordHasher>();
builder.Services.AddScoped<IAuthorizationService, AuthorizationService>();
builder.Services.AddScoped<ISurveyRepository, SurveyRepository>();
builder.Services.AddScoped<IQuestionRepository, QuestionRepository>();
builder.Services.AddScoped<IAnswerVariantsRepository, AnswerVariantsRepository>();
builder.Services.AddScoped<ICompletionRepository, CompletionRepository>();
builder.Services.AddScoped<IAnswerRepository, AnswerRepository>();
builder.Services.AddScoped<ISurveyService, SurveyService>();
builder.Services.AddScoped<IQuestionService, QuestionService>();
builder.Services.AddScoped<IAnswerVariantsService, AnswerVariantsService>();
builder.Services.AddScoped<ICompletionService, CompletionService>();
builder.Services.AddScoped<IAnswerService, AnswerService>();
builder.Services.AddSurveyBackendInfrastructure();
builder.Services.AddSurveyLibInfrastructure();
builder.Services.AddSurveyBackendServices();
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>