Skip to content

Commit

Permalink
Rewrote invalid profiles check
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathanio123 committed Aug 28, 2024
1 parent d1950a2 commit 48f6522
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Fusion.Summary.Api/Controllers/DepartmentsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,13 @@ public async Task<IActionResult> PutV1(string sapDepartmentId, [FromBody] PutDep
.Concat(request.DelegateResourceOwnersAzureUniqueId)
.Select(p => new PersonIdentifier(p));

if ((await ResolvePersonsAsync(personIdentifiers)).FirstOrDefault(r => !r.Success) is { } unresolvedProfile)
return BadRequest($"{unresolvedProfile.Identifier} could not be resolved");
var unresolvedProfiles = (await ResolvePersonsAsync(personIdentifiers))
.Where(r => !r.Success)
.ToList();

if (unresolvedProfiles.Count != 0)
return BadRequest($"Profiles: {string.Join(',', unresolvedProfiles)} could not be resolved");


var department = await DispatchAsync(new GetDepartment(sapDepartmentId));

Expand Down

0 comments on commit 48f6522

Please sign in to comment.