Moved API and DB methods to interfaces in order to leverage Dependency Injection, disolved APICaller class, including functionality in several other functions, included Single Load Lock information into Production Passdown report, changed persistant data file to json instead of xml, and adjusted persistant data file to include a week's worth of data instead of a single day.

This commit is contained in:
Daniel Wathen
2022-12-02 14:41:19 -07:00
parent e9c071c8f7
commit 740896adf0
31 changed files with 857 additions and 549 deletions

View File

@ -0,0 +1,41 @@
using ReportingServices.ReportingObjects;
using System.Text.Json;
namespace ReportingServices.Dependency_Injections
{
public class FabTimeReportingRepository : IFabTimeReportingRepository
{
public async Task<List<ReactorOutsByRDS>> GetMovesTrendData(string url)
{
return await GetJsonData<List<ReactorOutsByRDS>>(url);
}
public async Task<List<EquipmentStateByDay>> GetToolStateTrendData(string url)
{
return await GetJsonData<List<EquipmentStateByDay>>(url);
}
public async Task<List<ToolStateCurrent>> GetToolStateData(string url)
{
return await GetJsonData<List<ToolStateCurrent>>(url);
}
public async Task<T> GetJsonData<T>(string url)
{
T deserializedJson;
using (var client = new HttpClient())
{
using (HttpResponseMessage response = await client.GetAsync(url))
{
string apiResponse = await response.Content.ReadAsStringAsync();
deserializedJson = JsonSerializer.Deserialize<T>(apiResponse);
}
}
return deserializedJson;
}
}
}