forked from bcgov/supreme-court-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Events loaded dynamically - My Schedule vs Judges Calendar - PCSS Locations instead of JC-Int locations used
- Loading branch information
Timaqt
authored and
Timaqt
committed
Nov 27, 2024
1 parent
52cde11
commit cdb699a
Showing
14 changed files
with
457 additions
and
265 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using JCCommon.Clients.LocationServices; | ||
using LazyCache; | ||
using Microsoft.Extensions.Configuration; | ||
using Newtonsoft.Json.Serialization; | ||
using PCSSClient.Clients.PCSSLocationsServices; | ||
using Scv.Api.Helpers; | ||
using Scv.Api.Helpers.ContractResolver; | ||
using System; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using System.Collections.Generic; | ||
using System.Threading; | ||
using pcss_client.Models; | ||
|
||
namespace Scv.Api.Services | ||
{ | ||
/// <summary> | ||
/// This should handle caching and PCSSLocationsServicesClient. | ||
/// </summary> | ||
public class LocationPCSSService | ||
{ | ||
#region Variables | ||
|
||
private readonly IAppCache _cache; | ||
private readonly IConfiguration _configuration; | ||
private PCSSLocationsServicesClient _pcssLocationsClient { get; } | ||
|
||
#endregion Variables | ||
|
||
#region Properties | ||
|
||
#endregion Properties | ||
|
||
#region Constructor | ||
|
||
public LocationPCSSService(IConfiguration configuration, PCSSLocationsServicesClient pcssLocationsClient, | ||
IAppCache cache) | ||
{ | ||
_configuration = configuration; | ||
_pcssLocationsClient = pcssLocationsClient; | ||
_cache = cache; | ||
_cache.DefaultCachePolicy.DefaultCacheDurationSeconds = int.Parse(configuration.GetNonEmptyValue("Caching:LocationExpiryMinutes")) * 60; | ||
SetupLocationServicesClient(); | ||
} | ||
|
||
#endregion Constructor | ||
|
||
#region Collection Methods | ||
|
||
public async Task<ICollection<PCSSLocation>> PCSSLocationsGetAsync() | ||
{ | ||
var locations = await _pcssLocationsClient.LocationsGetAsync(CancellationToken.None); | ||
|
||
return locations; | ||
} | ||
|
||
|
||
#endregion Collection Methods | ||
|
||
#region Lookup Methods | ||
|
||
|
||
#endregion Lookup Methods | ||
|
||
#region Helpers | ||
private void SetupLocationServicesClient() | ||
{ | ||
_pcssLocationsClient.JsonSerializerSettings.ContractResolver = new SafeContractResolver { NamingStrategy = new CamelCaseNamingStrategy() }; | ||
} | ||
|
||
#endregion Helpers | ||
} | ||
} |
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.