feat(api): Вынес логику формирования расписания в сервис IEsppSchTypeConfigService. В респонс шаблона добавил отображение расписания. Получение шаблона по ИД.

This commit is contained in:
Mikhail Trubnikov
2023-10-12 12:06:47 +10:00
parent c2c381896b
commit b177c0cc27
10 changed files with 186 additions and 88 deletions

View File

@@ -70,20 +70,23 @@ namespace PARR.API.Controllers.V1
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
//[HttpGet(ApiRoutes.Template.Get)]
//public async Task<IActionResult> GetById([FromRoute] Guid id)
//{
// var template = await templateService.GetWithIncludes()
// .AsSplitQuery()
// .FirstOrDefaultAsync(t => t.Id == id);
[HttpGet(ApiRoutes.Template.Get)]
public async Task<IActionResult> GetById([FromRoute] Guid id)
{
var template = await templateService.GetWithIncludes()
.Include(t => t.RobotConfigurations).ThenInclude(t => t.Robot)
.Include(t => t.RobotConfigurations).ThenInclude(t => t.TaskStatus)
.Include(t => t.RobotConfigurations).ThenInclude(t => t.RobotStatus)
.AsSplitQuery()
.FirstOrDefaultAsync(t => t.Id == id);
// if (template == null)
// return NotFound();
if (template == null)
return NotFound();
// var response = mapper.Map<TemplateResponse>(template);
var response = mapper.Map<TemplateResponse>(template);
// return Ok(new Response<TemplateResponse>(response, true));
//}
return Ok(new Response<TemplateResponse>(response, true));
}
/// <summary>
/// Получить один шаблон по заданному статусу