Skip to content

Commit

Permalink
Merge pull request #587 from DFE-Digital/feature/create-complete-proj…
Browse files Browse the repository at this point in the history
…ects

Feature/create complete projects
  • Loading branch information
paullocknimble authored Oct 18, 2024
2 parents 1bf427d + f93e92d commit a92fecf
Show file tree
Hide file tree
Showing 74 changed files with 17,681 additions and 139 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ public class IncompleteProjectsGetDataQueryTests
private readonly Fixture _fixture = new();

private readonly ConversionProjectRepository _subject;
private readonly AcademisationContext _context;
private Mock<IMapper> _mockMapper = new Mock<IMapper>();
private readonly AcademisationContext _context;
private readonly IMediator _mediator;
public IncompleteProjectsGetDataQueryTests()
{
_context = new TestProjectContext(_mediator).CreateContext();
_subject = new ConversionProjectRepository(_context, _mockMapper.Object);
_subject = new ConversionProjectRepository(_context);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class ProjectGetDataQueryTests
public ProjectGetDataQueryTests()
{
_context = new TestProjectContext(_mediator).CreateContext();
_subject = new ConversionProjectRepository(_context, null);
_subject = new ConversionProjectRepository(_context);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class ProjectsListGetDataQueryTests
public ProjectsListGetDataQueryTests()
{
_context = new TestProjectContext(_mediator).CreateContext();
_subject = new ConversionProjectRepository(_context, null);
_subject = new ConversionProjectRepository(_context);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class ProjectStatusesDataQueryTests
public ProjectStatusesDataQueryTests()
{
_context = new TestProjectContext(_mediator).CreateContext();
_subject = new ConversionProjectRepository(_context, null);
_subject = new ConversionProjectRepository(_context);
}

[Fact]
Expand Down
12 changes: 11 additions & 1 deletion Dfe.Academies.Academisation.Data/AcademisationContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Dfe.Academies.Academisation.Domain.ApplicationAggregate;
using Dfe.Academies.Academisation.Domain.ApplicationAggregate.Schools;
using Dfe.Academies.Academisation.Domain.ApplicationAggregate.Trusts;
using Dfe.Academies.Academisation.Domain.CompleteTransmissionLog;
using Dfe.Academies.Academisation.Domain.ConversionAdvisoryBoardDecisionAggregate;
using Dfe.Academies.Academisation.Domain.Core.ConversionAdvisoryBoardDecisionAggregate;
using Dfe.Academies.Academisation.Domain.Core.ProjectAggregate;
Expand All @@ -12,7 +13,7 @@
using Dfe.Academies.Academisation.Domain.ProjectAggregate;
using Dfe.Academies.Academisation.Domain.ProjectGroupsAggregate;
using Dfe.Academies.Academisation.Domain.SeedWork;
using Dfe.Academies.Academisation.Domain.TransferProjectAggregate;
using Dfe.Academies.Academisation.Domain.TransferProjectAggregate;
using MediatR;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
Expand Down Expand Up @@ -51,6 +52,7 @@ public class AcademisationContext(DbContextOptions<AcademisationContext> options
public DbSet<Project> Projects { get; set; } = null!;
public DbSet<ProjectNote> ProjectNotes { get; set; } = null!;
public DbSet<ConversionAdvisoryBoardDecision> ConversionAdvisoryBoardDecisions { get; set; } = null!;
public DbSet<CompleteTransmissionLog> CompleteTransmissionLogs { get; set; } = null!;

public DbSet<TransferProject> TransferProjects { get; set; } = null!;
public DbSet<ProjectGroup> ProjectGroups { get; set; } = null!;
Expand Down Expand Up @@ -244,9 +246,17 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
modelBuilder.Entity<IntendedTransferBenefit>(ConfigureTransferProjectIntendedTransferBenefit);
modelBuilder.Entity<TransferringAcademy>(ConfigureTransferringAcademy);

modelBuilder.Entity<CompleteTransmissionLog>(ConfigureCompleteTransmissionLog);

base.OnModelCreating(modelBuilder);
}

private static void ConfigureCompleteTransmissionLog(EntityTypeBuilder<CompleteTransmissionLog> completeTransmissionLogConfiguration)
{
completeTransmissionLogConfiguration.ToTable("CompleteTransmissionLog", DEFAULT_SCHEMA);
completeTransmissionLogConfiguration.HasKey(x => x.Id);
}

private void ConfigureProjectGroup(EntityTypeBuilder<ProjectGroup> builder)
{
builder.ToTable("ProjectGroups", DEFAULT_SCHEMA);
Expand Down
21 changes: 21 additions & 0 deletions Dfe.Academies.Academisation.Data/Http/CompleteApiClientFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Dfe.Academisation.CorrelationIdMiddleware;

namespace Dfe.Academies.Academisation.Data.Http
{
public class CompleteApiClientFactory : ICompleteApiClientFactory
{
private readonly IHttpClientFactory _httpClientFactory;

public CompleteApiClientFactory(IHttpClientFactory httpClientFactory)
{
_httpClientFactory = httpClientFactory;
}

public HttpClient Create(ICorrelationContext correlationContext)
{
var httpClient = _httpClientFactory.CreateClient("CompleteApi");
httpClient.DefaultRequestHeaders.Add(Keys.HeaderKey, correlationContext.CorrelationId.ToString());
return httpClient;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Dfe.Academisation.CorrelationIdMiddleware;

namespace Dfe.Academies.Academisation.Data.Http
{
public interface ICompleteApiClientFactory
{
HttpClient Create(ICorrelationContext correlationContext);
}
}
Loading

0 comments on commit a92fecf

Please sign in to comment.