Просмотр исходного кода

added logger for statistics

pull/78/head
meris.ahmatovic 3 лет назад
Родитель
Сommit
23639f374c

+ 5
- 1
Diligent.WebAPI.Business/Services/AdService.cs Просмотреть файл

@@ -30,8 +30,12 @@
}
public async Task<List<AdResponseWithCountDto>> GetAllWithCountAsync()
{
_logger.LogInformation("Start getting all Ads with applicants count");
var today = DateTime.Now;
return _mapper.Map<List<AdResponseWithCountDto>>(await _context.Ads.Include(x => x.Applicants).Where(x => x.ExpiredAt > today).ToListAsync());
_logger.LogInformation("Getting data from database");
var res = _mapper.Map<List<AdResponseWithCountDto>>(await _context.Ads.Include(x => x.Applicants).Where(x => x.ExpiredAt > today).ToListAsync());
_logger.LogInformation($"Received {res.Count} ads with their counts");
return res;
}
public async Task<AdResponseDto> GetByIdAsync(int id)
{

+ 3
- 0
Diligent.WebAPI.Business/Services/SelectionProcessService.cs Просмотреть файл

@@ -68,8 +68,11 @@ namespace Diligent.WebAPI.Business.Services

public async Task<List<SelectionLevelInfoDto>> GetCountByLevels(List<string> statuses)
{
_logger.LogInformation("Start getting all Selection levels");
var res = await _context.SelectionLevels.Include(n => n.SelectionProcesses).ToListAsync();

_logger.LogInformation($"Received {res.Count} selection levels");
_logger.LogInformation("Mapping levels with process counts to SelectionLevelInfo");
var resMapped = res.Select(n => new SelectionLevelInfoDto
{
Level = n.Name,

+ 1
- 0
Diligent.WebAPI.Host/Controllers/V1/StatsController.cs Просмотреть файл

@@ -14,6 +14,7 @@
_adService = adService;
}

[Authorize]
[HttpGet]
public async Task<IActionResult> GetStats()
{

Загрузка…
Отмена
Сохранить