Add new domain models and interfaces for project management features
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
|
||||
|
||||
|
||||
using GozareshgirProgramManager.Application._Common.Behaviors;
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.CustomerAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.RoleAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.SkillAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.UserAgg.Repositories;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence.Context;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence.Repositories;
|
||||
using GozareshgirProgramManager.Infrastructure.Services.Authentication;
|
||||
using MediatR;
|
||||
using FluentValidation;
|
||||
using GozareshgirProgramManager.Domain.CheckoutAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.RoleAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.SkillAgg.Repositories;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure;
|
||||
|
||||
public static class DependencyInjection
|
||||
{
|
||||
public static IServiceCollection AddProgramManagerInfrastructure(
|
||||
this IServiceCollection services,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
// DbContext
|
||||
services.AddDbContext<ProgramManagerDbContext>(options =>
|
||||
options.UseSqlServer(
|
||||
configuration.GetConnectionString("ProgramManagerDb"),
|
||||
b => b.MigrationsAssembly(typeof(ProgramManagerDbContext).Assembly.FullName)));
|
||||
|
||||
// Register IAppDbContext
|
||||
services.AddScoped<IProgramManagerDbContext>(provider =>
|
||||
provider.GetRequiredService<ProgramManagerDbContext>());
|
||||
|
||||
|
||||
|
||||
#region GozareshgirDbContext
|
||||
|
||||
services.AddDbContext<GozareshgirDbContext>(x => x.UseSqlServer(configuration.GetConnectionString("GozareshgirDb")));
|
||||
|
||||
services.AddScoped<IGozareshgirDbContext>(provider =>
|
||||
provider.GetRequiredService<GozareshgirDbContext>());
|
||||
#endregion
|
||||
|
||||
// Unit of Work
|
||||
services.AddScoped<IUnitOfWork, UnitOfWork>();
|
||||
|
||||
//Users
|
||||
services.AddScoped<IUserRepository, UserRepository>();
|
||||
|
||||
//Roles
|
||||
services.AddScoped<IRoleRepository, RoleRepository>();
|
||||
|
||||
//WorkingHours
|
||||
services.AddScoped<ISalaryPaymentSettingRepository, SalaryPaymentSettingRepository>();
|
||||
|
||||
//Checkout
|
||||
services.AddScoped<ICheckoutRepository, CheckoutRepository>();
|
||||
|
||||
// Repositories
|
||||
services.AddScoped<ICustomerRepository, CustomerRepository>();
|
||||
|
||||
// Legacy Project repositories
|
||||
services.AddScoped<ITaskSectionRepository, TaskSectionRepository>();
|
||||
|
||||
// New Hierarchy repositories
|
||||
services.AddScoped<IProjectRepository, ProjectRepository>();
|
||||
services.AddScoped<IProjectPhaseRepository, ProjectPhaseRepository>();
|
||||
services.AddScoped<IProjectTaskRepository, ProjectTaskRepository>();
|
||||
services.AddScoped<ITaskSectionActivityRepository, TaskSectionActivityRepository>();
|
||||
services.AddScoped<IPhaseSectionRepository, PhaseSectionRepository>();
|
||||
services.AddScoped<IProjectSectionRepository, ProjectSectionRepository>();
|
||||
|
||||
services.AddScoped<ISkillRepository, SkillRepository>();
|
||||
|
||||
services.AddScoped<IUserRefreshTokenRepository, UserRefreshTokenRepository>();
|
||||
|
||||
// JWT Settings
|
||||
services.Configure<JwtSettings>(configuration.GetSection("JwtSettings"));
|
||||
|
||||
// Authentication Services
|
||||
services.AddScoped<JwtTokenGenerator>();
|
||||
services.AddScoped<IAuthHelper, AuthHelper>();
|
||||
|
||||
|
||||
|
||||
|
||||
// MediatR Validation Behavior
|
||||
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>));
|
||||
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user