diff --git a/AsbCloudApp/Repositories/ITrajectoryEditableRepository.cs b/AsbCloudApp/Repositories/ITrajectoryEditableRepository.cs
index 1cdd2742..58738f83 100644
--- a/AsbCloudApp/Repositories/ITrajectoryEditableRepository.cs
+++ b/AsbCloudApp/Repositories/ITrajectoryEditableRepository.cs
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace AsbCloudApp.Repositories
{
///
- /// CRUD для работы с плановой траекторией из клиента
+ /// CRUD-репозиторий для работы с траекторией из клиента (плановой и фактической)
///
///
//TrajectoryGeoPlanDto
diff --git a/AsbCloudApp/Repositories/ITrajectoryNnbRepository.cs b/AsbCloudApp/Repositories/ITrajectoryNnbRepository.cs
index b74229ee..65a3efcc 100644
--- a/AsbCloudApp/Repositories/ITrajectoryNnbRepository.cs
+++ b/AsbCloudApp/Repositories/ITrajectoryNnbRepository.cs
@@ -1,13 +1,9 @@
using AsbCloudApp.Data;
-using AsbCloudApp.Data.WITS;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
namespace AsbCloudApp.Repositories
{
///
- /// CRUD для работы с фактической траекторией из клиента
+ /// репозиторий для работы с траекторией из ннб (фактической)
///
///
public interface ITrajectoryNnbRepository : ITrajectoryRepository
diff --git a/AsbCloudApp/Repositories/ITrajectoryRepository.cs b/AsbCloudApp/Repositories/ITrajectoryRepository.cs
index ab4e5d59..4202bd0a 100644
--- a/AsbCloudApp/Repositories/ITrajectoryRepository.cs
+++ b/AsbCloudApp/Repositories/ITrajectoryRepository.cs
@@ -1,8 +1,5 @@
using AsbCloudApp.Data;
-using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -15,7 +12,7 @@ namespace AsbCloudApp.Repositories
where T : TrajectoryGeoDto
{
///
- /// Получить все добавленные по скважине координаты плановой траектории
+ /// Получить все добавленные по скважине координаты траектории
///
///
///
diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs
index 58a99260..d993f260 100644
--- a/AsbCloudInfrastructure/DependencyInjection.cs
+++ b/AsbCloudInfrastructure/DependencyInjection.cs
@@ -255,8 +255,8 @@ namespace AsbCloudInfrastructure
services.AddTransient();
services.AddTransient();
services.AddTransient();
- services.AddTransient, TrajectoryPlanRepository>();
- services.AddTransient, TrajectoryPlanRepository>();
+ services.AddTransient, TrajectoryEditableRepository>();
+ services.AddTransient, TrajectoryEditableRepository>();
services.AddTransient();
services.AddTransient();
services.AddTransient();
diff --git a/AsbCloudInfrastructure/Repository/TrajectoryPlanRepository.cs b/AsbCloudInfrastructure/Repository/TrajectoryEditableRepository.cs
similarity index 90%
rename from AsbCloudInfrastructure/Repository/TrajectoryPlanRepository.cs
rename to AsbCloudInfrastructure/Repository/TrajectoryEditableRepository.cs
index 676fde93..a48312ba 100644
--- a/AsbCloudInfrastructure/Repository/TrajectoryPlanRepository.cs
+++ b/AsbCloudInfrastructure/Repository/TrajectoryEditableRepository.cs
@@ -14,14 +14,18 @@ using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Repository
{
-
- public class TrajectoryPlanRepository : ITrajectoryEditableRepository
+ ///
+ /// CRUD-репозиторий для работы с траекториями (плановыми и фактическими)
+ ///
+ ///
+ ///
+ public class TrajectoryEditableRepository : ITrajectoryEditableRepository
where TEntity : Trajectory
where Tdto : TrajectoryGeoDto
{
private readonly IAsbCloudDbContext db;
private readonly IWellService wellService;
- public TrajectoryPlanRepository(IAsbCloudDbContext db, IWellService wellService)
+ public TrajectoryEditableRepository(IAsbCloudDbContext db, IWellService wellService)
{
this.db = db;
this.wellService = wellService;
diff --git a/AsbCloudInfrastructure/Repository/TrajectoryFactRepository.cs b/AsbCloudInfrastructure/Repository/TrajectoryFactRepository.cs
deleted file mode 100644
index b8d5bfad..00000000
--- a/AsbCloudInfrastructure/Repository/TrajectoryFactRepository.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-//using AsbCloudApp.Data;
-//using AsbCloudApp.Exceptions;
-//using AsbCloudApp.Repositories;
-//using AsbCloudApp.Services;
-//using AsbCloudDb.Model;
-//using Mapster;
-//using Microsoft.EntityFrameworkCore;
-//using System;
-//using System.Collections.Generic;
-//using System.Linq;
-//using System.Threading;
-//using System.Threading.Tasks;
-
-//namespace AsbCloudInfrastructure.Repository
-//{
-// internal class TrajectoryFactRepository : ITrajectoryEditableRepository
-// {
-// private readonly IAsbCloudDbContext db;
-// private readonly IWellService wellService;
-// public TrajectoryFactRepository(IAsbCloudDbContext db, IWellService wellService)
-// {
-// this.db = db;
-// this.wellService = wellService;
-// }
-
-// public async Task AddAsync(TrajectoryGeoFactDto importedFactTrajectoryRow, CancellationToken token)
-// {
-// var offsetHours = wellService.GetTimezone(importedFactTrajectoryRow.IdWell).Hours;
-// var entity = Convert(importedFactTrajectoryRow, offsetHours);
-// entity.Id = 0;
-// db.FactTrajectories.Add(entity);
-// return await db.SaveChangesAsync(token)
-// .ConfigureAwait(false);
-// }
-
-// public async Task AddRangeAsync(IEnumerable trajectoryRows, CancellationToken token)
-// {
-// var idWell = trajectoryRows.First().IdWell;
-// if (!trajectoryRows.All(r => r.IdWell == idWell))
-// throw new ArgumentInvalidException(nameof(trajectoryRows), "Все строки должны относиться к одной скважине");
-
-// var offsetHours = wellService.GetTimezone(idWell).Hours;
-// var entities = trajectoryRows
-// .Select(e =>
-// {
-// var entity = Convert(e, offsetHours);
-// entity.Id = 0;
-// return entity;
-// });
-
-// db.FactTrajectories.AddRange(entities);
-
-// return await db.SaveChangesAsync(token)
-// .ConfigureAwait(false);
-// }
-
-// public async Task DeleteByIdWellAsync(int idWell, CancellationToken token)
-// {
-// var query = db.FactTrajectories
-// .Where(e => e.IdWell == idWell);
-// db.FactTrajectories.RemoveRange(query);
-
-// return await db.SaveChangesAsync(token)
-// .ConfigureAwait(false);
-// }
-
-// public async Task DeleteRangeAsync(IEnumerable ids, CancellationToken token)
-// {
-// var query = db.FactTrajectories
-// .Where(e => ids.Contains(e.Id));
-// db.FactTrajectories.RemoveRange(query);
-// return await db.SaveChangesAsync(token)
-// .ConfigureAwait(false);
-// }
-
-// public async Task> GetAsync(int idWell, CancellationToken token)
-// {
-// var well = wellService.GetOrDefault(idWell)
-// ?? throw new ArgumentInvalidException(nameof(idWell), "idWell doesn`t exist");
-
-// var offsetHours = well.Timezone.Hours;
-// var query = db.FactTrajectories
-// .AsNoTracking()
-// .Where(x => x.IdWell == idWell);
-// var entities = await query
-// .OrderBy(e => e.WellboreDepth)
-// .ToArrayAsync(token);
-// var result = entities
-// .Select(r => Convert(r, offsetHours));
-// return result;
-// }
-
-// public async Task UpdateAsync(TrajectoryGeoFactDto row, CancellationToken token)
-// {
-// var offsetHours = wellService.GetTimezone(row.IdWell).Hours;
-// var entity = Convert(row, offsetHours);
-// db.FactTrajectories.Update(entity);
-// return await db.SaveChangesAsync(token)
-// .ConfigureAwait(false);
-// }
-
-// private TrajectoryGeoFactDto Convert(FactTrajectory entity, double offsetHours)
-// {
-// var dto = entity.Adapt();
-// dto.UpdateDate = entity.UpdateDate.ToRemoteDateTime(offsetHours);
-// return dto;
-// }
-
-// private FactTrajectory Convert(TrajectoryGeoFactDto dto, double offsetHours)
-// {
-// var entity = dto.Adapt();
-// entity.UpdateDate = DateTime.Now.ToUtcDateTimeOffset(offsetHours);
-// return entity;
-// }
-// }
-//}
diff --git a/AsbCloudWebApi/Controllers/Trajectory/FactTrajectoryController.cs b/AsbCloudWebApi/Controllers/Trajectory/FactTrajectoryController.cs
index e06dcad0..73716012 100644
--- a/AsbCloudWebApi/Controllers/Trajectory/FactTrajectoryController.cs
+++ b/AsbCloudWebApi/Controllers/Trajectory/FactTrajectoryController.cs
@@ -21,7 +21,7 @@ namespace AsbCloudWebApi.Controllers.Trajectory;
[Route("api/well/{idWell}/[controller]")]
public class FactTrajectoryController : ControllerBase
{
- private readonly ITrajectoryEditableRepository trajectoryFactRepository;
+ private readonly ITrajectoryEditableRepository factTrajectoryRepository;
private readonly IWellService wellService;
private readonly FactTrajectoryImportService factTrajectoryImportService;
@@ -30,7 +30,7 @@ public class FactTrajectoryController : ControllerBase
IWellService wellService,
FactTrajectoryImportService factTrajectoryImportService)
{
- this.trajectoryFactRepository = trajectoryFactRepository;
+ this.factTrajectoryRepository = trajectoryFactRepository;
this.wellService = wellService;
this.factTrajectoryImportService = factTrajectoryImportService;
}
@@ -46,7 +46,7 @@ public class FactTrajectoryController : ControllerBase
public async Task GetRowsAsync([FromRoute] int idWell,
CancellationToken cancellationToken)
{
- var importedFactTrajectories = await trajectoryFactRepository.GetAsync(idWell,
+ var importedFactTrajectories = await factTrajectoryRepository.GetAsync(idWell,
cancellationToken);
return Ok(importedFactTrajectories);
@@ -71,7 +71,7 @@ public class FactTrajectoryController : ControllerBase
return Forbid();
row.IdUser = idUser.Value;
row.IdWell = idWell;
- var result = await trajectoryFactRepository.AddAsync(row, token);
+ var result = await factTrajectoryRepository.AddAsync(row, token);
return Ok(result);
}
@@ -96,7 +96,7 @@ public class FactTrajectoryController : ControllerBase
row.Id = idRow;
row.IdUser = idUser.Value;
row.IdWell = idWell;
- var result = await trajectoryFactRepository.UpdateAsync(row, token);
+ var result = await factTrajectoryRepository.UpdateAsync(row, token);
return Ok(result);
}
@@ -115,7 +115,7 @@ public class FactTrajectoryController : ControllerBase
token).ConfigureAwait(false))
return Forbid();
- var result = await trajectoryFactRepository.DeleteRangeAsync(new int[] { idRow }, token);
+ var result = await factTrajectoryRepository.DeleteRangeAsync(new int[] { idRow }, token);
return Ok(result);
}
@@ -188,9 +188,9 @@ public class FactTrajectoryController : ControllerBase
var trajectoryRows = await factTrajectoryImportService.ImportAsync(idWell, idUser.Value, stream, token);
if (deleteBeforeImport)
- await trajectoryFactRepository.DeleteByIdWellAsync(idWell, token);
+ await factTrajectoryRepository.DeleteByIdWellAsync(idWell, token);
- var rowsCount = await trajectoryFactRepository.AddRangeAsync(trajectoryRows, token);
+ var rowsCount = await factTrajectoryRepository.AddRangeAsync(trajectoryRows, token);
return Ok(rowsCount);
}