Skip to content

Commit

Permalink
refactoring some names
Browse files Browse the repository at this point in the history
  • Loading branch information
mikestock-nimble committed Sep 1, 2023
1 parent f582219 commit 169f0d9
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public async Task GetProjectTaskList_Returns_200()
context.Kpi.Add(project);
await context.SaveChangesAsync();

var taskListResponse = await _client.GetAsync($"/api/v1/client/projects/{project.ProjectStatusProjectId}/tasks/list/summary");
var taskListResponse = await _client.GetAsync($"/api/v1/client/projects/{project.ProjectStatusProjectId}/tasks/summary");
taskListResponse.StatusCode.Should().Be(HttpStatusCode.OK);

var content = await taskListResponse.Content.ReadFromJsonAsync<ApiSingleResponseV2<ProjectByTaskSummaryResponse>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ namespace Dfe.ManageFreeSchoolProjects.API.Controllers
[ApiController]
public class ProjectTaskController : ControllerBase
{
public readonly IUpdateProjectTaskService _updateProjectTaskService;
public readonly IUpdateProjectByTaskService _updateProjectTaskService;
public readonly IGetProjectByTaskService _getProjectByTaskService;
public readonly ILogger<ProjectTaskController> _logger;

public ProjectTaskController(
IUpdateProjectTaskService updateProjectTaskService,
IUpdateProjectByTaskService updateProjectTaskService,
IGetProjectByTaskService getProjectByTaskService,
ILogger<ProjectTaskController> logger)
{
Expand Down Expand Up @@ -47,7 +47,7 @@ public async Task<ActionResult<ApiSingleResponseV2<GetProjectByTaskResponse>>> G
}

[HttpGet]
[Route("list/summary")]
[Route("summary")]
public ActionResult<ApiSingleResponseV2<ProjectByTaskSummaryResponse>> GetProjectTaskListSummary(string projectId)
{
_logger.LogMethodEntered();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static IServiceCollection AddApiDependencies(this IServiceCollection serv
services.AddScoped<ICreateProjectService, CreateProject>();
services.AddScoped<ICreateUserService, CreateUserService>();
services.AddScoped<IGetProjectOverviewService, GetProjectOverviewService>();
services.AddScoped<IUpdateProjectTaskService, UpdateProjectTaskService>();
services.AddScoped<IUpdateProjectByTaskService, UpdateProjectByTaskService>();
services.AddScoped<IGetProjectByTaskService, GetProjectByTaskService>();

services.AddValidatorsFromAssembly(Assembly.Load(Assembly.GetExecutingAssembly().FullName));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@

namespace Dfe.ManageFreeSchoolProjects.API.UseCases.Project.Tasks
{
public interface IUpdateProjectTaskService
public interface IUpdateProjectByTaskService
{
public Task Execute(string projectId, UpdateProjectByTaskRequest request);
}

public class UpdateProjectTaskService : IUpdateProjectTaskService
public class UpdateProjectByTaskService : IUpdateProjectByTaskService
{
public readonly MfspContext _context;

public UpdateProjectTaskService(MfspContext context)
public UpdateProjectByTaskService(MfspContext context)
{
_context = context;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public IActionResult OnGet()
return Page();
}

public async System.Threading.Tasks.Task OnPostAsync()
public async Task<IActionResult> OnPostAsync()
{
using MemoryStream stream = new MemoryStream();

Expand All @@ -44,6 +44,8 @@ public async System.Threading.Tasks.Task OnPostAsync()
RowErrors = _createBulkProjectValidator.Validate(projectTable);

ProjectTable = projectTable;

return Page();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Dfe.ManageFreeSchoolProjects.Pages.Project.Tasks
{
public class TaskListModel : PageModel
{
private readonly IGetProjectTaskListSummaryService _getProjectTaskListSummaryService;
private readonly IGetProjectByTaskSummaryService _getProjectTaskListSummaryService;
private readonly ILogger<TaskListModel> _logger;

[BindProperty(SupportsGet = true, Name = "projectId")]
Expand All @@ -20,7 +20,7 @@ public class TaskListModel : PageModel
public ProjectByTaskSummaryResponse ProjectTaskListSummary { get; set; }

public TaskListModel(
IGetProjectTaskListSummaryService getProjectTaskListSummaryService,
IGetProjectByTaskSummaryService getProjectTaskListSummaryService,
ILogger<TaskListModel> logger)
{
_getProjectTaskListSummaryService = getProjectTaskListSummaryService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@

namespace Dfe.ManageFreeSchoolProjects.Services.Project
{
public interface IGetProjectTaskListSummaryService
public interface IGetProjectByTaskSummaryService
{
public Task<ProjectByTaskSummaryResponse> Execute(string projectId);
}

public class GetProjectTaskListSummaryService : IGetProjectTaskListSummaryService
public class GetProjectByTaskSummaryService : IGetProjectByTaskSummaryService
{
private readonly MfspApiClient _apiClient;

public GetProjectTaskListSummaryService(MfspApiClient apiClient)
public GetProjectByTaskSummaryService(MfspApiClient apiClient)
{
_apiClient = apiClient;
}

public async Task<ProjectByTaskSummaryResponse> Execute(string projectId)
{
var endpoint = $"/api/v1/client/projects/{projectId}/tasks/list/summary";
var endpoint = $"/api/v1/client/projects/{projectId}/tasks/summary";

var result = await _apiClient.Get<ApiSingleResponseV2<ProjectByTaskSummaryResponse>>(endpoint);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void ConfigureServices(IServiceCollection services)
services.AddScoped<ICreateBulkProjectValidator, CreateBulkProjectValidator>();
services.AddScoped<IGetProjectByTaskService, GetProjectByTaskService>();
services.AddScoped<IUpdateProjectByTaskService, UpdateProjectByTaskService>();
services.AddScoped<IGetProjectTaskListSummaryService, GetProjectTaskListSummaryService>();
services.AddScoped<IGetProjectByTaskSummaryService, GetProjectByTaskSummaryService>();

services.AddScoped(sp => sp.GetService<IHttpContextAccessor>()?.HttpContext?.Session);
services.AddSession(options =>
Expand Down

0 comments on commit 169f0d9

Please sign in to comment.