forked from ddrilling/AsbCloudServer
Правки по PR
This commit is contained in:
parent
8ca313a18a
commit
80bad5bbe2
@ -8,6 +8,6 @@ namespace AsbCloudApp.Services
|
|||||||
{
|
{
|
||||||
public interface IScheduleService : ICrudService<ScheduleDto>
|
public interface IScheduleService : ICrudService<ScheduleDto>
|
||||||
{
|
{
|
||||||
Task<IEnumerable<ScheduleDto>> GetSchedule(int idWell,DateTimeOffset dateStart, DateTimeOffset dateEnd, CancellationToken token = default);
|
Task<DrillerDto> GetSchedule(int idWell,DateTimeOffset workTime, CancellationToken token = default);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -285,6 +285,14 @@ namespace AsbCloudDb.Model
|
|||||||
.ToView("mw_telemetry_datas_saub_stat");
|
.ToView("mw_telemetry_datas_saub_stat");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<ScheduleItem>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasOne(d => d.Driller)
|
||||||
|
.WithMany(p => p.Schedule)
|
||||||
|
.HasForeignKey(d => d.IdDriller)
|
||||||
|
.HasConstraintName("t_schedule_t_driller_id_driller");
|
||||||
|
});
|
||||||
|
|
||||||
FillData(modelBuilder);
|
FillData(modelBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ using System.ComponentModel.DataAnnotations;
|
|||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace AsbCloudDb.Model
|
namespace AsbCloudDb.Model
|
||||||
@ -27,5 +28,9 @@ namespace AsbCloudDb.Model
|
|||||||
[Column("patronymic"), Comment("Отчество")]
|
[Column("patronymic"), Comment("Отчество")]
|
||||||
[StringLength(255)]
|
[StringLength(255)]
|
||||||
public string Patronymic { get; set; }
|
public string Patronymic { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
[InverseProperty(nameof(ScheduleItem.Driller))]
|
||||||
|
public virtual ICollection<ScheduleItem> Schedule { get; set; } = null!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,9 +35,10 @@ namespace AsbCloudDb.Model
|
|||||||
public DateTimeOffset DrillEnd { get; set; }
|
public DateTimeOffset DrillEnd { get; set; }
|
||||||
|
|
||||||
[ForeignKey(nameof(IdDriller))]
|
[ForeignKey(nameof(IdDriller))]
|
||||||
|
[InverseProperty(nameof(Model.Driller.Schedule))]
|
||||||
public virtual Driller Driller { get; set; }
|
public virtual Driller Driller { get; set; }
|
||||||
|
|
||||||
[ForeignKey(nameof(IdWell))]
|
[ForeignKey(nameof(IdWell))]
|
||||||
public virtual Well well { get; set; }
|
public virtual Well Well { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,49 +9,36 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services
|
namespace AsbCloudInfrastructure.Services
|
||||||
{
|
{
|
||||||
public class DrillerService : CrudCacheServiceBase<DrillerDto, Driller>, IDrillerService
|
public class DrillerService : CrudServiceBase<DrillerDto, Driller>, IDrillerService
|
||||||
{
|
{
|
||||||
|
public DrillerService(IAsbCloudDbContext context) : base(context)
|
||||||
private IAsbCloudDbContext context;
|
|
||||||
|
|
||||||
public DrillerService(IAsbCloudDbContext db, CacheDb cacheDb) : base(db, cacheDb)
|
|
||||||
{
|
{
|
||||||
context= db;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task<int> DeleteAsync(int id, CancellationToken dto)
|
public async Task<int> DeleteAsync(int id, CancellationToken dto)
|
||||||
{
|
{
|
||||||
var result = await Cache.RemoveAsync(o => o.Id == id);
|
return await base.DeleteAsync(id, dto);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task<IEnumerable<DrillerDto>> GetAllAsync(CancellationToken token)
|
public async Task<IEnumerable<DrillerDto>> GetAllAsync(CancellationToken token)
|
||||||
{
|
{
|
||||||
return await base.GetAllAsync(token);
|
return await base.GetAllAsync(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task<DrillerDto> GetAsync(int id, CancellationToken token)
|
public async Task<DrillerDto> GetAsync(int id, CancellationToken token)
|
||||||
{
|
{
|
||||||
var res= await Cache.FirstOrDefaultAsync(o=>o.Id==id,token)
|
return await base.GetAsync(id,token)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
if (res is null)
|
|
||||||
return null;
|
|
||||||
var dto = Convert(res);
|
|
||||||
return dto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task<int> InsertAsync(DrillerDto dto, CancellationToken token)
|
public async Task<int> InsertAsync(DrillerDto dto, CancellationToken token)
|
||||||
{
|
{
|
||||||
var entity = Convert(dto);
|
return await base.InsertAsync(dto, token);
|
||||||
var result = await Cache.InsertAsync(entity, token);
|
|
||||||
return result.Id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task<int> UpdateAsync(int id, DrillerDto dto, CancellationToken token)
|
public async Task<int> UpdateAsync(int id, DrillerDto dto, CancellationToken token)
|
||||||
{
|
{
|
||||||
var entity = Convert(dto);
|
return await base.UpdateAsync(id,dto, token);
|
||||||
var result = await Cache.UpsertAsync(entity, token);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
using AsbCloudApp.Services;
|
using AsbCloudApp.Services;
|
||||||
using AsbCloudDb.Model;
|
using AsbCloudDb.Model;
|
||||||
using AsbCloudInfrastructure.Services.Cache;
|
using AsbCloudInfrastructure.Services.Cache;
|
||||||
|
using Mapster;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -10,58 +12,55 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services
|
namespace AsbCloudInfrastructure.Services
|
||||||
{
|
{
|
||||||
public class ScheduleService : CrudCacheServiceBase<ScheduleDto, ScheduleItem>, IScheduleService
|
public class ScheduleService : CrudServiceBase<ScheduleDto, ScheduleItem>, IScheduleService
|
||||||
{
|
{
|
||||||
|
public ScheduleService(IAsbCloudDbContext context) : base(context)
|
||||||
private IAsbCloudDbContext context;
|
|
||||||
|
|
||||||
public ScheduleService(IAsbCloudDbContext db, CacheDb cacheDb) : base(db, cacheDb)
|
|
||||||
{
|
{
|
||||||
context= db;
|
Includes.Add(nameof(ScheduleItem.Driller));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task<int> DeleteAsync(int id, CancellationToken dto)
|
public async Task<int> DeleteAsync(int id, CancellationToken dto)
|
||||||
{
|
{
|
||||||
var result = await Cache.RemoveAsync(o => o.Id == id);
|
return await base.DeleteAsync(id,dto);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task<IEnumerable<ScheduleDto>> GetAllAsync(CancellationToken token)
|
public async Task<IEnumerable<ScheduleDto>> GetAllAsync(CancellationToken token)
|
||||||
{
|
{
|
||||||
return await base.GetAllAsync(token);
|
return await base.GetAllAsync(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task<ScheduleDto> GetAsync(int id, CancellationToken token)
|
public async Task<ScheduleDto> GetAsync(int id, CancellationToken token)
|
||||||
{
|
{
|
||||||
var res= await Cache.FirstOrDefaultAsync(o=>o.Id==id,token)
|
var res= await base.GetAsync(id,token)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
if (res is null)
|
|
||||||
return null;
|
|
||||||
var dto = Convert(res);
|
|
||||||
return dto;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<IEnumerable<ScheduleDto>> GetSchedule(int idWell, DateTimeOffset dateStart, DateTimeOffset dateEnd, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var entires=await Cache.WhereAsync(o=>o.IdWell==idWell
|
|
||||||
&&o.ShiftStart<=dateStart
|
|
||||||
&&o.ShiftEnd<=dateEnd).ConfigureAwait(false);
|
|
||||||
var res = entires?.Select(Convert);
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task<int> InsertAsync(ScheduleDto dto, CancellationToken token)
|
public async Task<DrillerDto> GetSchedule(int idWell, DateTimeOffset workTime, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var entity = Convert(dto);
|
IQueryable<ScheduleItem> query = context.Set<ScheduleItem>();
|
||||||
var result = await Cache.InsertAsync(entity, token);
|
foreach (var include in Includes)
|
||||||
return result.Id;
|
query = query.Include(include);
|
||||||
|
|
||||||
|
var entires = query.Where(e => e.IdWell==idWell
|
||||||
|
&& e.DrillStart <= workTime
|
||||||
|
&& e.DrillEnd >= workTime)
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
if (entires is null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return entires.Driller.Adapt<DrillerDto>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task<int> UpdateAsync(int id, ScheduleDto dto, CancellationToken token)
|
public async Task<int> InsertAsync(ScheduleDto dto, CancellationToken token)
|
||||||
|
{
|
||||||
|
return await base.InsertAsync(dto,token);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<int> UpdateAsync(int id, ScheduleDto dto, CancellationToken token)
|
||||||
{
|
{
|
||||||
var entity = Convert(dto);
|
return await base.UpdateAsync(id,dto,token);
|
||||||
var result = await Cache.UpsertAsync(entity, token);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task GetListAsync_count()
|
public async Task GetListAsync_count()
|
||||||
{
|
{
|
||||||
var service = new DrillerService(context, cacheDb);
|
var service = new DrillerService(context);
|
||||||
|
|
||||||
///Добавляем элемент
|
///Добавляем элемент
|
||||||
var id = await service.InsertAsync(drillerObj, CancellationToken.None);
|
var id = await service.InsertAsync(drillerObj, CancellationToken.None);
|
||||||
@ -47,13 +47,13 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
|||||||
id = await service.InsertAsync(drillerObj, CancellationToken.None);
|
id = await service.InsertAsync(drillerObj, CancellationToken.None);
|
||||||
|
|
||||||
var newCount = (await service.GetAllAsync(CancellationToken.None)).Count();
|
var newCount = (await service.GetAllAsync(CancellationToken.None)).Count();
|
||||||
Assert.Equal(newCount, 3);
|
Assert.Equal(3, newCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task InsertAsync_returns_id()
|
public async Task InsertAsync_returns_id()
|
||||||
{
|
{
|
||||||
var service = new DrillerService(context, cacheDb);
|
var service = new DrillerService(context);
|
||||||
var id = await service.InsertAsync(drillerObj, CancellationToken.None);
|
var id = await service.InsertAsync(drillerObj, CancellationToken.None);
|
||||||
Assert.NotEqual(0, id);
|
Assert.NotEqual(0, id);
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task UpdateAsync_not_add_if_exists()
|
public async Task UpdateAsync_not_add_if_exists()
|
||||||
{
|
{
|
||||||
var service = new DrillerService(context, cacheDb);
|
var service = new DrillerService(context);
|
||||||
|
|
||||||
///Добавляем элемент
|
///Добавляем элемент
|
||||||
var id = await service.InsertAsync(drillerObj, CancellationToken.None);
|
var id = await service.InsertAsync(drillerObj, CancellationToken.None);
|
||||||
@ -78,7 +78,7 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task DeleteAsync_decrement_count()
|
public async Task DeleteAsync_decrement_count()
|
||||||
{
|
{
|
||||||
var service = new DrillerService(context, cacheDb);
|
var service = new DrillerService(context);
|
||||||
|
|
||||||
///Добавляем элемент
|
///Добавляем элемент
|
||||||
var id = await service.InsertAsync(drillerObj, CancellationToken.None);
|
var id = await service.InsertAsync(drillerObj, CancellationToken.None);
|
||||||
|
@ -39,7 +39,7 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task GetListAsync_count()
|
public async Task GetListAsync_count()
|
||||||
{
|
{
|
||||||
var service = new ScheduleService(context, cacheDb);
|
var service = new ScheduleService(context);
|
||||||
|
|
||||||
///Добавляем элемент
|
///Добавляем элемент
|
||||||
var id = await service.InsertAsync(entity, CancellationToken.None);
|
var id = await service.InsertAsync(entity, CancellationToken.None);
|
||||||
@ -53,7 +53,7 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task InsertAsync_returns_id()
|
public async Task InsertAsync_returns_id()
|
||||||
{
|
{
|
||||||
var service = new ScheduleService(context, cacheDb);
|
var service = new ScheduleService(context);
|
||||||
var id = await service.InsertAsync(entity, CancellationToken.None);
|
var id = await service.InsertAsync(entity, CancellationToken.None);
|
||||||
Assert.NotEqual(0, id);
|
Assert.NotEqual(0, id);
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task UpdateAsync_not_add_if_exists()
|
public async Task UpdateAsync_not_add_if_exists()
|
||||||
{
|
{
|
||||||
var service = new ScheduleService(context, cacheDb);
|
var service = new ScheduleService(context);
|
||||||
|
|
||||||
///Добавляем элемент
|
///Добавляем элемент
|
||||||
var id = await service.InsertAsync(entity, CancellationToken.None);
|
var id = await service.InsertAsync(entity, CancellationToken.None);
|
||||||
@ -78,7 +78,7 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task DeleteAsync_decrement_count()
|
public async Task DeleteAsync_decrement_count()
|
||||||
{
|
{
|
||||||
var service = new ScheduleService(context, cacheDb);
|
var service = new ScheduleService(context);
|
||||||
|
|
||||||
///Добавляем элемент
|
///Добавляем элемент
|
||||||
var id = await service.InsertAsync(entity, CancellationToken.None);
|
var id = await service.InsertAsync(entity, CancellationToken.None);
|
||||||
|
@ -7,13 +7,13 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace AsbCloudWebApi.Controllers
|
namespace AsbCloudWebApi.Controllers
|
||||||
{
|
{
|
||||||
[Route("api/admin/driller")]
|
[Route("api/driller")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class AdminDrillerController : ControllerBase
|
public class DrillerController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly IDrillerService drillerService;
|
private readonly IDrillerService drillerService;
|
||||||
public AdminDrillerController(IDrillerService drillerService)
|
public DrillerController(IDrillerService drillerService)
|
||||||
{
|
{
|
||||||
this.drillerService = drillerService;
|
this.drillerService = drillerService;
|
||||||
}
|
}
|
||||||
@ -43,16 +43,16 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получить бурильщика по идентификатору
|
/// Получить бурильщика по идентификатору
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="DrillerId">Идентификатор</param>
|
/// <param name="drillerId">Идентификатор</param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns>Объект, описывающий бурильщика</returns>
|
/// <returns>Объект, описывающий бурильщика</returns>
|
||||||
[HttpGet("{DrillerId}")]
|
[HttpGet("{drillerId}")]
|
||||||
public async Task<IActionResult> GetAsync(int DrillerId, CancellationToken token = default)
|
public async Task<IActionResult> GetAsync(int drillerId, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var driller = await drillerService.GetAsync(DrillerId, token)
|
var driller = await drillerService.GetAsync(drillerId, token)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
return Ok(driller);
|
return Ok(driller);
|
||||||
}
|
}
|
||||||
@ -60,15 +60,15 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Обновить данные о бурильщике
|
/// Обновить данные о бурильщике
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="DrillerId">Идентификатор</param>
|
/// <param name="drillerId">Идентификатор</param>
|
||||||
/// <param name="dto">Объект с измененными данными</param>
|
/// <param name="dto">Объект с измененными данными</param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns>Количество измененых записей</returns>
|
/// <returns>Количество измененых записей</returns>
|
||||||
[HttpPut("{DrillerId}")]
|
[HttpPut("{drillerId}")]
|
||||||
public async Task<IActionResult> UpdateAsync(int DrillerId, DrillerDto dto,
|
public async Task<IActionResult> UpdateAsync(int drillerId, DrillerDto dto,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var result = await drillerService.UpdateAsync(DrillerId, dto, token)
|
var result = await drillerService.UpdateAsync(drillerId, dto, token)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
|
|
||||||
@ -77,13 +77,13 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Удалить бурильщика
|
/// Удалить бурильщика
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="DrillerId">Идентификатор бурильщика</param>
|
/// <param name="drillerId">Идентификатор бурильщика</param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns>Количество удаленных записей</returns>
|
/// <returns>Количество удаленных записей</returns>
|
||||||
[HttpDelete("{DrillerId}")]
|
[HttpDelete("{drillerId}")]
|
||||||
public async Task<ActionResult<int>> DeleteAsync(int DrillerId, CancellationToken token = default)
|
public async Task<ActionResult<int>> DeleteAsync(int drillerId, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var result = await drillerService.DeleteAsync(DrillerId, token)
|
var result = await drillerService.DeleteAsync(drillerId, token)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
@ -8,13 +8,13 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace AsbCloudWebApi.Controllers
|
namespace AsbCloudWebApi.Controllers
|
||||||
{
|
{
|
||||||
[Route("api/admin/schedule")]
|
[Route("api/schedule")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class AdminScheduleController : ControllerBase
|
public class ScheduleController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly IScheduleService scheduleService;
|
private readonly IScheduleService scheduleService;
|
||||||
public AdminScheduleController(IScheduleService service)
|
public ScheduleController(IScheduleService service)
|
||||||
{
|
{
|
||||||
this.scheduleService = service;
|
this.scheduleService = service;
|
||||||
}
|
}
|
||||||
@ -48,29 +48,28 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
/// Получить список записей графика для конкретной скважины
|
/// Получить список записей графика для конкретной скважины
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="idWell">Идентификатор скважины</param>
|
/// <param name="idWell">Идентификатор скважины</param>
|
||||||
/// <param name="dateStart">Начало периода</param>
|
/// <param name="workTime">Рабочее время</param>
|
||||||
/// <param name="dateEnd">Конец периода</param>
|
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns>Список записей графика</returns>
|
/// <returns>Список записей графика</returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<ActionResult<int>> GetScheduleAsync(int idWell, DateTimeOffset dateStart, DateTimeOffset dateEnd, CancellationToken token = default)
|
public async Task<ActionResult<int>> GetScheduleAsync(int idWell, DateTimeOffset workTime, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var result = await scheduleService.GetSchedule(idWell,dateStart,dateEnd, token);
|
var result = await scheduleService.GetSchedule(idWell,workTime, token);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Обновить график
|
/// Обновить график
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ScheduleId">Идентификатор записи</param>
|
/// <param name="scheduleId">Идентификатор записи</param>
|
||||||
/// <param name="dto">Элемент графика</param>
|
/// <param name="dto">Элемент графика</param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns>Количнство обновленных записей</returns>
|
/// <returns>Количнство обновленных записей</returns>
|
||||||
[HttpPut("{ScheduleId}")]
|
[HttpPut("{scheduleId}")]
|
||||||
public async Task<IActionResult> UpdateAsync(int ScheduleId, ScheduleDto dto,
|
public async Task<IActionResult> UpdateAsync(int scheduleId, ScheduleDto dto,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var result = await scheduleService.UpdateAsync(ScheduleId, dto, token)
|
var result = await scheduleService.UpdateAsync(scheduleId, dto, token)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
|
|
||||||
@ -79,13 +78,13 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Удалить запись из графика
|
/// Удалить запись из графика
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ScheduleId">Идентификатор записи</param>
|
/// <param name="scheduleId">Идентификатор записи</param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpDelete("{ScheduleId}")]
|
[HttpDelete("{scheduleId}")]
|
||||||
public async Task<ActionResult<int>> DeleteAsync(int ScheduleId, CancellationToken token = default)
|
public async Task<ActionResult<int>> DeleteAsync(int scheduleId, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var result = await scheduleService.DeleteAsync(ScheduleId, token)
|
var result = await scheduleService.DeleteAsync(scheduleId, token)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user