feat(api): Вынес логику формирования расписания в сервис IEsppSchTypeConfigService. В респонс шаблона добавил отображение расписания. Получение шаблона по ИД.
This commit is contained in:
@@ -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>
|
||||
/// Получить один шаблон по заданному статусу
|
||||
|
||||
Reference in New Issue
Block a user