Fix task and shift self-assignment features
Some checks failed
CI Pipeline / Backend Build & Test (pull_request) Successful in 48s
CI Pipeline / Frontend Lint, Test & Build (pull_request) Failing after 28s
CI Pipeline / Infrastructure Validation (pull_request) Successful in 4s

This commit is contained in:
WorkClub Automation
2026-03-09 15:47:57 +01:00
parent 271b3c189c
commit 672dec5f21
17 changed files with 400 additions and 62 deletions

View File

@@ -42,20 +42,24 @@ public static class ShiftEndpoints
private static async Task<Ok<ShiftListDto>> GetShifts(
ShiftService shiftService,
HttpContext httpContext,
[FromQuery] DateTimeOffset? from = null,
[FromQuery] DateTimeOffset? to = null,
[FromQuery] int page = 1,
[FromQuery] int pageSize = 20)
{
var result = await shiftService.GetShiftsAsync(from, to, page, pageSize);
var externalUserId = httpContext.User.FindFirst("sub")?.Value;
var result = await shiftService.GetShiftsAsync(from, to, page, pageSize, externalUserId);
return TypedResults.Ok(result);
}
private static async Task<Results<Ok<ShiftDetailDto>, NotFound>> GetShift(
Guid id,
ShiftService shiftService)
ShiftService shiftService,
HttpContext httpContext)
{
var result = await shiftService.GetShiftByIdAsync(id);
var externalUserId = httpContext.User.FindFirst("sub")?.Value;
var result = await shiftService.GetShiftByIdAsync(id, externalUserId);
if (result == null)
return TypedResults.NotFound();
@@ -85,9 +89,11 @@ public static class ShiftEndpoints
private static async Task<Results<Ok<ShiftDetailDto>, NotFound, Conflict<string>>> UpdateShift(
Guid id,
UpdateShiftRequest request,
ShiftService shiftService)
ShiftService shiftService,
HttpContext httpContext)
{
var (shift, error, isConflict) = await shiftService.UpdateShiftAsync(id, request);
var externalUserId = httpContext.User.FindFirst("sub")?.Value;
var (shift, error, isConflict) = await shiftService.UpdateShiftAsync(id, request, externalUserId);
if (error != null)
{