public async Task <IActionResult> GetUserSession([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "assessment/session/{sessionId}")] HttpRequest request, string sessionId) { request.LogRequestHeaders(logService); var correlationId = Guid.Parse(correlationIdProvider.CorrelationId); logService.LogMessage($"CorrelationId: {correlationId} - Creating a new assessment", SeverityLevel.Information); var partitionKey = sessionClient.GeneratePartitionKey(sessionId); var existingUserSession = await userSessionRepository.GetByIdAsync(sessionId, partitionKey).ConfigureAwait(false); if (existingUserSession is null) { logService.LogMessage($"Unable to find User Session with id {sessionId}.", SeverityLevel.Information); return(responseWithCorrelation.ResponseWithCorrelationId(HttpStatusCode.NoContent, correlationId)); } var dfcUserSession = new DfcUserSession { SessionId = existingUserSession.UserSessionId, CreatedDate = existingUserSession.StartedDt, PartitionKey = existingUserSession.PartitionKey, Salt = existingUserSession.Salt, }; return(responseWithCorrelation.ResponseObjectWithCorrelationId(dfcUserSession, correlationId)); }
public async Task <IActionResult> GetSummaryList( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "summary")] HttpRequest request, [Inject] ISummaryService summaryService) { request.LogRequestHeaders(logService); var viewModels = await summaryService.GetSummaryList(request.GetAbsoluteUrlForRelativePath()).ConfigureAwait(false); if (viewModels is null || !viewModels.Any()) { return(responseWithCorrelation.ResponseWithCorrelationId(HttpStatusCode.NoContent)); } return(responseWithCorrelation.ResponseObjectWithCorrelationId(viewModels.OrderBy(jp => jp.Title))); }