Project Init
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
using ColaFlow.Shared.Kernel.Modules;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
using ColaFlow.Modules.ProjectManagement.Application.Behaviors;
|
||||
using ColaFlow.Modules.ProjectManagement.Application.Commands.CreateProject;
|
||||
using ColaFlow.Modules.ProjectManagement.Domain.Repositories;
|
||||
using ColaFlow.Modules.ProjectManagement.Infrastructure.Persistence;
|
||||
using ColaFlow.Modules.ProjectManagement.Infrastructure.Repositories;
|
||||
|
||||
namespace ColaFlow.Modules.ProjectManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Project Management Module
|
||||
/// Responsible for managing projects, epics, stories, and tasks.
|
||||
/// </summary>
|
||||
public class ProjectManagementModule : IModule
|
||||
{
|
||||
public string Name => "ProjectManagement";
|
||||
|
||||
public void RegisterServices(IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
// Register DbContext
|
||||
var connectionString = configuration.GetConnectionString("PMDatabase");
|
||||
services.AddDbContext<PMDbContext>(options =>
|
||||
options.UseNpgsql(connectionString));
|
||||
|
||||
// Register repositories
|
||||
services.AddScoped<IProjectRepository, ProjectRepository>();
|
||||
services.AddScoped<IUnitOfWork, UnitOfWork>();
|
||||
|
||||
// Register MediatR handlers from Application assembly
|
||||
services.AddMediatR(cfg =>
|
||||
{
|
||||
cfg.RegisterServicesFromAssembly(typeof(CreateProjectCommand).Assembly);
|
||||
});
|
||||
|
||||
// Register FluentValidation validators
|
||||
services.AddValidatorsFromAssembly(typeof(CreateProjectCommand).Assembly);
|
||||
|
||||
// Register pipeline behaviors
|
||||
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>));
|
||||
|
||||
Console.WriteLine($"[{Name}] Module services registered");
|
||||
}
|
||||
|
||||
public void ConfigureApplication(IApplicationBuilder app)
|
||||
{
|
||||
// Configure module-specific middleware if needed
|
||||
Console.WriteLine($"[{Name}] Module application configured");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user