DD.WellWorkover.Cloud/AsbCloudWebApi/Controllers/ScheduleController.cs

39 lines
1.3 KiB
C#

using AsbCloudApp.Data;
using AsbCloudApp.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudWebApi.Controllers
{
[Route("api/schedule")]
[ApiController]
[Authorize]
public class ScheduleController : CrudController<ScheduleDto, IScheduleService>
{
private readonly IScheduleService scheduleService;
public ScheduleController(IScheduleService scheduleService)
:base(scheduleService)
{
this.scheduleService = service;
}
/// <summary>
/// Получить бурильщика работавшего на скважине в определенное время.
/// </summary>
/// <param name="idWell">Идентификатор скважины</param>
/// <param name="workTime">Рабочее время</param>
/// <param name="token"></param>
/// <returns>бурильщик</returns>
[HttpGet("driller")]
public async Task<ActionResult<DrillerDto>> GetDrillerAsync(int idWell, DateTime workTime, CancellationToken token = default)
{
var result = await scheduleService.GetDrillerAsync(idWell,workTime, token);
return Ok(result);
}
}
}