Skip to content

Commit

Permalink
Merge pull request #597 from DFE-Digital/feature/add-trust-reference-…
Browse files Browse the repository at this point in the history
…number-to-transfer-project

Fixes after dev testing for sending projects to complete
  • Loading branch information
paullocknimble authored Oct 29, 2024
2 parents 29b2f58 + d3b4b8a commit 6d54e7a
Show file tree
Hide file tree
Showing 17 changed files with 36 additions and 20 deletions.
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Dfe.Academies.Academisation.IService.ServiceModels.Complete
{
public record CreateCompleteProjectSuccessResponse (Guid conversion_project_id)
public record CreateCompleteConversionProjectSuccessResponse (Guid conversion_project_id)
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ public string GetAllErrors()
ValidationErrors.InadequateOfsted?.Select(e => $"inadequate_ofsted: {e.Error}"),
ValidationErrors.FinancialSafeguardingGovernanceIssues?.Select(e => $"financial_safeguarding_governance_issues: {e.Error}"),
ValidationErrors.OutgoingTrustToClose?.Select(e => $"outgoing_trust_to_close: {e.Error}"),
ValidationErrors.OutgoingTrustUkprn?.Select(e => $"outgoing_trust_to_close: {e.Error}"),
ValidationErrors.OutgoingTrustUkprn?.Select(e => $"outgoing_trust_ukprn: {e.Error}"),
ValidationErrors.NewTrustReferenceNumber?.Select(e => $"new_trust_reference_number: {e.Error}"),
ValidationErrors.NewTrustName?.Select(e => $"new_trust_name: {e.Error}"),

};

Expand Down Expand Up @@ -110,6 +112,14 @@ public class ValidationErrors
[JsonPropertyName("outgoing_trust_ukprn")]

public List<ErrorDetail> OutgoingTrustUkprn { get; set; }

[JsonPropertyName("new_trust_reference_number")]

public List<ErrorDetail> NewTrustReferenceNumber { get; set; }

[JsonPropertyName("new_trust_name")]

public List<ErrorDetail> NewTrustName { get; set; }
}

public class ErrorDetail
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Dfe.Academies.Academisation.IService.ServiceModels.Complete
{
public record CreateCompleteTransferProjectSuccessResponse (Guid transfer_project_id)
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public async Task Handle_ConversionProjectsExist_SuccessfulResponse_ReturnsComma
var command = _fixture.Create<CreateCompleteConversionProjectsCommand>();
var conversionProjects = _fixture.CreateMany<IProject>().ToList();
var advisoryDecision = _fixture.Create<ConversionAdvisoryBoardDecision>();
var successResponse = _fixture.Create<CreateCompleteProjectSuccessResponse>();
var successResponse = _fixture.Create<CreateCompleteConversionProjectSuccessResponse>();
var projectGroup = _fixture.Create<Domain.ProjectGroupsAggregate.ProjectGroup>();
var mockContext = new Mock<IUnitOfWork>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public async Task Handle_ConversionProjectsExist_SuccessfulResponse_ReturnsComma
var command = _fixture.Create<CreateCompleteFormAMatConversionProjectsCommand>();
var conversionProjects = _fixture.CreateMany<IProject>().ToList();
var advisoryDecision = _fixture.Create<ConversionAdvisoryBoardDecision>();
var successResponse = _fixture.Create<CreateCompleteProjectSuccessResponse>();
var successResponse = _fixture.Create<CreateCompleteConversionProjectSuccessResponse>();
var projectGroup = _fixture.Create<Domain.ProjectGroupsAggregate.ProjectGroup>();
var mockContext = new Mock<IUnitOfWork>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public async Task Handle_ConversionProjectsExist_SuccessfulResponse_ReturnsComma
}

var advisoryDecision = _fixture.Create<ConversionAdvisoryBoardDecision>();
var successResponse = _fixture.Create<CreateCompleteProjectSuccessResponse>();
var successResponse = _fixture.Create<CreateCompleteConversionProjectSuccessResponse>();
var projectGroup = _fixture.Create<Domain.ProjectGroupsAggregate.ProjectGroup>();
var mockContext = new Mock<IUnitOfWork>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public async Task Handle_ConversionProjectsExist_SuccessfulResponse_ReturnsComma
}

var advisoryDecision = _fixture.Create<ConversionAdvisoryBoardDecision>();
var successResponse = _fixture.Create<CreateCompleteProjectSuccessResponse>();
var successResponse = _fixture.Create<CreateCompleteConversionProjectSuccessResponse>();
var projectGroup = _fixture.Create<Domain.ProjectGroupsAggregate.ProjectGroup>();
var mockContext = new Mock<IUnitOfWork>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public async Task<CommandResult> Handle(CreateCompleteConversionProjectsCommand

if (response.IsSuccessStatusCode)
{
var successResponse = await response.Content.ReadFromJsonAsync<CreateCompleteProjectSuccessResponse>();
var successResponse = await response.Content.ReadFromJsonAsync<CreateCompleteConversionProjectSuccessResponse>();
completeProjectId = successResponse.conversion_project_id;

_logger.LogInformation("Success sending conversion project to complete with project urn: {project} with Status code 201 ", completeObject.urn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public async Task<CommandResult> Handle(CreateCompleteFormAMatConversionProjects

if (response.IsSuccessStatusCode)
{
var successResponse = await response.Content.ReadFromJsonAsync<CreateCompleteProjectSuccessResponse>();
var successResponse = await response.Content.ReadFromJsonAsync<CreateCompleteConversionProjectSuccessResponse>();
completeProjectId = successResponse.conversion_project_id;

_logger.LogInformation("Success sending conversion project to complete with project urn: {project} with Status code 201 ", completeObject.urn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ public async Task<CommandResult> Handle(CreateCompleteFormAMatTransferProjectsCo
if (response.IsSuccessStatusCode)
{
var successResponse =
await response.Content.ReadFromJsonAsync<CreateCompleteProjectSuccessResponse>();
await response.Content.ReadFromJsonAsync<CreateCompleteTransferProjectSuccessResponse>();

completeProjectId = successResponse.conversion_project_id;
completeProjectId = successResponse.transfer_project_id;

_logger.LogInformation(
"Success sending transfer to complete with project urn: {project} with Status code 201 ",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ public async Task<CommandResult> Handle(CreateCompleteTransferProjectsCommand re
if (response.IsSuccessStatusCode)
{
var successResponse =
await response.Content.ReadFromJsonAsync<CreateCompleteProjectSuccessResponse>();
await response.Content.ReadFromJsonAsync<CreateCompleteTransferProjectSuccessResponse>();

completeProjectId = successResponse.conversion_project_id;
completeProjectId = successResponse.transfer_project_id;

_logger.LogInformation(
"Success sending transfer project to complete with project urn: {project} with Status code 201 ",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ public class SetTransferProjectTrustCommand : SetTransferProjectCommand
{
public string ProjectName { get; set; }
public string? IncomingTrustUKPRN { get; set; }
public string? IncomingTrustReferenceNumber { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Dfe.Academies.Academisation.IDomain.ConversionAdvisoryBoardDecisionAggregate;
using System;
using Dfe.Academies.Academisation.IDomain.ConversionAdvisoryBoardDecisionAggregate;
using Dfe.Academies.Academisation.IDomain.ProjectAggregate;
using Dfe.Academies.Academisation.IDomain.TransferProjectAggregate;
using Dfe.Academies.Academisation.IService.ServiceModels.Complete;
Expand All @@ -22,7 +23,7 @@ internal static CompleteConversionProjectServiceModel FromDomain(IProject projec
project.Details.HeadTeacherBoardDate.ToString(),
conditions,
project.Details.ProposedConversionDate.ToString(),
true,
project.Details.AcademyTypeAndRoute?.Equals("Sponsored") ?? false,
email,
firstName,
lastName,
Expand All @@ -47,7 +48,7 @@ internal static CompleteFormAMatConversionProjectServiceModel FormAMatFromDomain
project.Details.HeadTeacherBoardDate.ToString(),
conditions,
project.Details.ProposedConversionDate.ToString(),
true,
project.Details.AcademyTypeAndRoute?.Equals("Sponsored") ?? false,
email,
firstName,
lastName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ internal static CompleteFormAMatTransferProjectServiceModel FormAMatFromDomain(I
// Transfer projects aren't currently added to groups
null,
// Need the trust reference number, proposed trust name is held in the incoming trust name field
"TrustReferenceNumber",
"trustreferencenumber",
incomingName
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
await mediator.Send(new CreateCompleteConversionProjectsCommand(), stoppingToken);
await mediator.Send(new CreateCompleteTransferProjectsCommand(), stoppingToken);
await mediator.Send(new CreateCompleteFormAMatConversionProjectsCommand(), stoppingToken);
//await mediator.Send(new CreateCompleteFormAMatTransferProjectsCommand(), stoppingToken);
}
catch (Exception ex)
{
Expand Down
2 changes: 1 addition & 1 deletion Dfe.Academies.Academisation.WebApi/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
"TransferCreation": "",
"SuperAdmin": ""
},
"SendProjectsToComplete" : "true"
"SendProjectsToComplete" : "false"
}

0 comments on commit 6d54e7a

Please sign in to comment.