Skip to content

Commit

Permalink
fix: Direct requests assigned to incorrect org unit (#729)
Browse files Browse the repository at this point in the history
- [x] New feature
- [x] Bug fix
- [ ] High impact

**Description of work:**
After change to the departments for managers all direct requests are now
added to incorrect org unit. This means the manager of the inteded
manager is now getting notifications about requests.


**Testing:**
- [ ] Can be tested
- [ ] Automatic tests created / updated
- [ ] Local tests are passing

TBD


**Checklist:**
- [ ] Considered automated tests
- [ ] Considered updating specification / documentation
- [ ] Considered work items 
- [ ] Considered security
- [ ] Performed developer testing
- [ ] Checklist finalized / ready for review

Hotfix, needed as we keep generating error in prod.
  • Loading branch information
HansDahle authored Dec 2, 2024
1 parent ab0c33a commit 1961320
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@
{
public class ApiPersonAllocationRequestStatus
{
/// <summary>
/// Should the request be auto approved?
/// </summary>
public bool AutoApproval { get; set; }

/// <summary>
/// Applicable manager for the user. This is based on who is set as manager in Entra ID.
/// </summary>
public ApiPerson? Manager { get; set; }

/// <summary>
/// The relevant org unit requests should be assigned to.
/// </summary>
public Services.LineOrg.ApiModels.ApiOrgUnit? RequestOrgUnit { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Fusion.AspNetCore.OData;
using Microsoft.VisualBasic;
using NodaTime.TimeZones;
using Fusion.Services.LineOrg.ApiModels;

namespace Fusion.Resources.Api.Controllers
{
Expand Down Expand Up @@ -327,10 +328,13 @@ public async Task<ActionResult<ApiPersonAllocationRequestStatus>> GetPersonReque
var autoApproval = await DispatchAsync(new Domain.Queries.GetPersonAutoApprovalStatus(user.azureId));
var manager = await DispatchAsync(new Domain.Queries.GetResourceOwner(user.azureId));

var orgUnit = await DispatchAsync(new ResolveLineOrgUnit(user.fullDepartment));

return new ApiPersonAllocationRequestStatus
{
AutoApproval = autoApproval.GetValueOrDefault(false),
Manager = manager is not null ? new ApiPerson(manager) : null
Manager = manager is not null ? new ApiPerson(manager) : null,
RequestOrgUnit = orgUnit
};
}

Expand Down

0 comments on commit 1961320

Please sign in to comment.