-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update notifications: AverageTimeToHandleRequests and ChangesForResou…
…rceDepartment
- Loading branch information
1 parent
f33d72c
commit 5034621
Showing
6 changed files
with
212 additions
and
33 deletions.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
src/backend/function/Fusion.Resources.Functions/ApiClients/IOrgApiClient.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using Fusion.ApiClients.Org; | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace Fusion.Resources.Functions.ApiClients; | ||
|
||
public interface IOrgClient | ||
{ | ||
Task<ApiChangeLog> GetChangeLog(string projectId, string positionId, string instanceId); | ||
} | ||
|
||
|
||
#region model | ||
public class ApiChangeLog | ||
{ | ||
public Guid ProjectId { get; set; } | ||
public DateTimeOffset? FirstEventDate { get; set; } | ||
public DateTimeOffset? LastEventDate { get; set; } | ||
public List<ApiChangeLogEvent> Events { get; set; } | ||
|
||
} | ||
|
||
public class ApiChangeLogEvent | ||
{ | ||
|
||
public Guid? PositionId { get; set; } | ||
public string? PositionName { get; set; } | ||
public string? PositionExternalId { get; set; } | ||
public Guid? InstanceId { get; set; } | ||
public string Name { get; set; } | ||
public string ChangeCategory { get; set; } | ||
public ApiPersonV2? Actor { get; set; } | ||
public DateTimeOffset TimeStamp { get; set; } | ||
public string? Description { get; set; } | ||
public string ChangeType { get; set; } | ||
public object? PayLoad { get; set; } | ||
|
||
public ApiInstanceSnapshot? Instance { get; init; } | ||
|
||
public Guid EventId { get; set; } | ||
public string EventFriendlyName { get; set; } | ||
|
||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] | ||
public Guid? DraftId { get; set; } | ||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] | ||
public string? ChangeSource { get; set; } | ||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] | ||
public string? ChangeSourceId { get; set; } | ||
|
||
public class ApiInstanceSnapshot | ||
{ | ||
public DateTime? AppliesFrom { get; set; } | ||
public DateTime? AppliesTo { get; set; } | ||
public double? WorkLoad { get; set; } | ||
} | ||
} | ||
|
||
public enum ChangeType | ||
{ | ||
PositionInstanceCreated, | ||
PersonAssignedToPosition, | ||
PositionInstanceAllocationStateChanged, | ||
PositionInstanceAppliesToChanged, | ||
PositionInstanceAppliesFromChanged, | ||
PositionInstanceParentPositionIdChanged, | ||
PositionInstancePercentChanged, | ||
PositionInstanceLocationChanged | ||
} | ||
|
||
#endregion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/backend/function/Fusion.Resources.Functions/ApiClients/OrgApiClient.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#nullable enable | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
using Fusion.Resources.Functions.ApiClients.ApiModels; | ||
using Fusion.Resources.Functions.Integration; | ||
|
||
namespace Fusion.Resources.Functions.ApiClients; | ||
|
||
public class OrgClient : IOrgClient | ||
{ | ||
private readonly HttpClient orgClient; | ||
|
||
public OrgClient(IHttpClientFactory httpClientFactory) | ||
{ | ||
orgClient = httpClientFactory.CreateClient(HttpClientNames.Application.Org); | ||
orgClient.Timeout = TimeSpan.FromMinutes(5); | ||
} | ||
|
||
public async Task<ApiChangeLog> GetChangeLog(string projectId, string positionId, string instanceId) | ||
{ | ||
var data = | ||
await orgClient.GetAsJsonAsync<ApiChangeLog>($"/projects/{projectId}/positions/{positionId}/instances/{instanceId}/change-log?api-version=2.0"); | ||
|
||
return data; | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.