Add UnemploymentData

This commit is contained in:
2025-11-21 10:52:34 -05:00
parent 2e93e544ba
commit feb3ad4f5f
6 changed files with 467 additions and 168 deletions

View File

@@ -0,0 +1,59 @@
using MarketData.MarketDataModel;
using MarketData.DataAccess;
using MarketDataServer.Authorization;
using MarketData;
using Microsoft.AspNetCore.Mvc;
using LogLevel = MarketData.LogLevel;
using MarketData.Utils;
namespace MarketDataServer.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class EconomicIndicastorsController : ControllerBase
{
//http://localhost:8000/api/EconomicIndicators/GetDistnctIndicators
[HttpGet(Name = "GetDistinctEconomicIndicators")]
public IEnumerable<String> GetDistinctEconomicIndicators(String token)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
return EconomicIndicatorDA.GetDistinctIndicators();
}
catch(Exception exception)
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
[HttpGet(Name = "GetEconomicIndicators")]
public IEnumerable<EconomicIndicator> GetEconomicIndicators(String token,String indicatorCode)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
EconomicIndicators economicIndicators=EconomicIndicatorDA.GetEconomicIndicators(indicatorCode);
return economicIndicators;
}
catch(Exception exception)
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
}
}