Add EmployeeId as filter in the endpoints, add endpoints to get all active and historical surveys for a particular employee

This commit is contained in:
Reginald Cherenfant Jasmin
2023-09-21 00:58:29 -04:00
parent 8d386af40a
commit a0033ca045
10 changed files with 347 additions and 143 deletions

View File

@ -4,16 +4,18 @@ using Newtonsoft.Json;
namespace DamageAssesment.Api.SurveyResponses.Services
{
public class SurveyServiceProvider :ServiceProviderBase, ISurveyServiceProvider
public class SurveyServiceProvider : ServiceProviderBase, ISurveyServiceProvider
{
public SurveyServiceProvider(IConfiguration configuration, IHttpUtil httpUtil, ILogger<EmployeeServiceProvider> logger) : base(configuration, httpUtil, logger, configuration.GetValue<string>("RessourceSettings:Survey"), configuration.GetValue<string>("EndPointSettings:SurveyUrlBase"))
{
}
public async Task<List<Survey>> getSurveysAsync()
public async Task<List<Survey>> getSurveysAsync(string language)
{
try
{
if (!string.IsNullOrEmpty(language))
url = url + "/" + language;
var responseJsonString = await httpUtil.SendAsync(HttpMethod.Get, url, null);
var surveys = JsonConvert.DeserializeObject<List<Survey>>(responseJsonString);
@ -36,7 +38,7 @@ namespace DamageAssesment.Api.SurveyResponses.Services
var responseJsonString = await httpUtil.SendAsync(HttpMethod.Get, url, null);
var survey = JsonConvert.DeserializeObject<Survey>(responseJsonString);
if (survey == null )
if (survey == null)
return null;
else return survey;
}