Refactor
Some checks failed
Code Coverage / Generate Coverage Report (push) Has been cancelled
Tests / Run Tests (9.0.x) (push) Has been cancelled
Tests / Docker Build Test (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled

This commit is contained in:
Yaojia Wang
2025-11-03 21:02:14 +01:00
parent 5c541ddb79
commit a220e5d5d7
64 changed files with 3867 additions and 732 deletions

View File

@@ -7,12 +7,8 @@ namespace ColaFlow.Modules.ProjectManagement.Infrastructure.Persistence;
/// <summary>
/// Project Management Module DbContext
/// </summary>
public class PMDbContext : DbContext
public class PMDbContext(DbContextOptions<PMDbContext> options) : DbContext(options)
{
public PMDbContext(DbContextOptions<PMDbContext> options) : base(options)
{
}
public DbSet<Project> Projects => Set<Project>();
public DbSet<Epic> Epics => Set<Epic>();
public DbSet<Story> Stories => Set<Story>();

View File

@@ -6,14 +6,9 @@ namespace ColaFlow.Modules.ProjectManagement.Infrastructure.Persistence;
/// <summary>
/// Unit of Work implementation for ProjectManagement module
/// </summary>
public class UnitOfWork : IUnitOfWork
public class UnitOfWork(PMDbContext context) : IUnitOfWork
{
private readonly PMDbContext _context;
public UnitOfWork(PMDbContext context)
{
_context = context ?? throw new ArgumentNullException(nameof(context));
}
private readonly PMDbContext _context = context ?? throw new ArgumentNullException(nameof(context));
public async Task<int> SaveChangesAsync(CancellationToken cancellationToken = default)
{

View File

@@ -9,14 +9,9 @@ namespace ColaFlow.Modules.ProjectManagement.Infrastructure.Repositories;
/// <summary>
/// Project repository implementation using EF Core
/// </summary>
public class ProjectRepository : IProjectRepository
public class ProjectRepository(PMDbContext context) : IProjectRepository
{
private readonly PMDbContext _context;
public ProjectRepository(PMDbContext context)
{
_context = context ?? throw new ArgumentNullException(nameof(context));
}
private readonly PMDbContext _context = context ?? throw new ArgumentNullException(nameof(context));
public async Task<Project?> GetByIdAsync(ProjectId id, CancellationToken cancellationToken = default)
{