diff --git a/Api.SeaHavenIndustries.Tests/WorkOrderControllerSearchTests.cs b/Api.SeaHavenIndustries.Tests/WorkOrderControllerSearchTests.cs index 10ac872..c2a11aa 100644 --- a/Api.SeaHavenIndustries.Tests/WorkOrderControllerSearchTests.cs +++ b/Api.SeaHavenIndustries.Tests/WorkOrderControllerSearchTests.cs @@ -4,6 +4,7 @@ using FluentAssertions; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Moq; +using SeaHaven.DataServices.Implementation; using SeaHaven.DataServices.Interfaces; using SeaHaven.Services.DTOs; using SeaHaven.Services.Helpers; @@ -60,4 +61,17 @@ public class WorkOrderControllerSearchTests body.Status.Should().Be("Error"); body.Message.Should().Contain("dateFrom"); } + + [Fact] + public async Task GetBoard_WhenWeekEndBeforeWeekStart_ReturnsBadRequest() + { + var controller = NewController(Mock.Of()); + + var result = await controller.GetBoard( + new DateOnly(2026, 6, 22), + new DateOnly(2026, 6, 15)); + + var badRequest = result.Should().BeOfType().Subject; + badRequest.Value.Should().BeOfType().Which.Should().Contain("weekEnd"); + } } diff --git a/Api.SeaHavenIndustries/Controllers/WorkOrderBoardController.cs b/Api.SeaHavenIndustries/Controllers/WorkOrderBoardController.cs index 204b742..85f6698 100644 --- a/Api.SeaHavenIndustries/Controllers/WorkOrderBoardController.cs +++ b/Api.SeaHavenIndustries/Controllers/WorkOrderBoardController.cs @@ -53,6 +53,7 @@ namespace Api.SeaHavenIndustries.Controllers [FromQuery] List? dispatchers = null, [FromQuery] bool myWorkOrders = false, [FromQuery] List? types = null, + [FromQuery] bool overdue = false, [FromQuery] string? search = null) { var resolvedWeekEnd = weekEnd ?? weekStart.AddDays(4); @@ -70,6 +71,7 @@ namespace Api.SeaHavenIndustries.Controllers Dispatchers = dispatchers, MyWorkOrders = myWorkOrders, Types = types, + Overdue = overdue, Search = search }; diff --git a/Data.SeaHavenIndustries/Auth/ApplicationDbContext.cs b/Data.SeaHavenIndustries/Auth/ApplicationDbContext.cs index 48c34fe..2e214bb 100644 --- a/Data.SeaHavenIndustries/Auth/ApplicationDbContext.cs +++ b/Data.SeaHavenIndustries/Auth/ApplicationDbContext.cs @@ -206,7 +206,7 @@ namespace Data.SeaHavenIndustries return bytes; } - + } public class ApplicationUser : IdentityUser { @@ -222,8 +222,8 @@ namespace Data.SeaHavenIndustries public string? Initials { get; set; } public string? Color { get; set; } public int? Type { get; set; } // 1 for users 0 for admin - public ICollection