forked from ddrilling/AsbCloudServer
Автотесты
This commit is contained in:
parent
6af038496c
commit
832489b9ac
@ -8,12 +8,6 @@ namespace AsbCloudApp.Requests;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ProcessMapPlanBaseRequest: ChangeLogBaseRequest
|
public class ProcessMapPlanBaseRequest: ChangeLogBaseRequest
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Тип секции
|
|
||||||
/// </summary>
|
|
||||||
[Range(1, int.MaxValue, ErrorMessage = "Id секции - положительное число")]
|
|
||||||
public int? IdWellSectionType { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Вернуть данные, которые поменялись с указанной даты
|
/// Вернуть данные, которые поменялись с указанной даты
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -42,7 +36,6 @@ public class ProcessMapPlanBaseRequestWithWell: ProcessMapPlanBaseRequest
|
|||||||
public ProcessMapPlanBaseRequestWithWell(ProcessMapPlanBaseRequest request, int idWell)
|
public ProcessMapPlanBaseRequestWithWell(ProcessMapPlanBaseRequest request, int idWell)
|
||||||
{
|
{
|
||||||
IdWell=idWell;
|
IdWell=idWell;
|
||||||
IdWellSectionType=request.IdWellSectionType;
|
|
||||||
UpdateFrom = request.UpdateFrom;
|
UpdateFrom = request.UpdateFrom;
|
||||||
Moment = request.Moment;
|
Moment = request.Moment;
|
||||||
}
|
}
|
||||||
|
@ -134,9 +134,9 @@ namespace AsbCloudInfrastructure
|
|||||||
|
|
||||||
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanDrillingDto>>.NewConfig()
|
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanDrillingDto>>.NewConfig()
|
||||||
.Include<ProcessMapPlanDrilling, ChangeLogDto<ProcessMapPlanDrillingDto>>()
|
.Include<ProcessMapPlanDrilling, ChangeLogDto<ProcessMapPlanDrillingDto>>()
|
||||||
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanDrilling>()
|
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanDrillingDto>()
|
||||||
{
|
{
|
||||||
Item = src.Adapt<ProcessMapPlanDrilling>()
|
Item = src.Adapt<ProcessMapPlanDrillingDto>()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,6 +249,7 @@ public abstract class ChangeLogRepositoryAbstract<TDto, TEntity, TRequest> : ICh
|
|||||||
{
|
{
|
||||||
var query = BuildQuery(request);
|
var query = BuildQuery(request);
|
||||||
var entities = await query
|
var entities = await query
|
||||||
|
.Where(e => e.Obsolete == null)
|
||||||
.OrderBy(e => e.Creation)
|
.OrderBy(e => e.Creation)
|
||||||
.ThenBy(e => e.Obsolete)
|
.ThenBy(e => e.Obsolete)
|
||||||
.ThenBy(e => e.Id)
|
.ThenBy(e => e.Id)
|
||||||
|
@ -32,9 +32,6 @@ public class ProcessMapPlanBaseRepository<TDto, TEntity> : ChangeLogRepositoryAb
|
|||||||
.Include(e => e.WellSectionType)
|
.Include(e => e.WellSectionType)
|
||||||
.Where(e => e.IdWell == request.IdWell);
|
.Where(e => e.IdWell == request.IdWell);
|
||||||
|
|
||||||
if (request.IdWellSectionType.HasValue)
|
|
||||||
query = query.Where(e => e.IdWellSectionType == request.IdWellSectionType);
|
|
||||||
|
|
||||||
if (request.UpdateFrom.HasValue)
|
if (request.UpdateFrom.HasValue)
|
||||||
{
|
{
|
||||||
var from = request.UpdateFrom.Value.ToUniversalTime();
|
var from = request.UpdateFrom.Value.ToUniversalTime();
|
||||||
|
@ -5,15 +5,15 @@ using Refit;
|
|||||||
|
|
||||||
namespace AsbCloudWebApi.IntegrationTests.Clients;
|
namespace AsbCloudWebApi.IntegrationTests.Clients;
|
||||||
|
|
||||||
public interface IProcessMapPlanDrillingClient
|
public interface IProcessMapPlanDrillingClient<TDto> where TDto : ProcessMapPlanBaseDto
|
||||||
{
|
{
|
||||||
private const string BaseRoute = "/api/well/{idWell}/ProcessMapPlanDrilling";
|
private const string BaseRoute = "/api/well/{idWell}/ProcessMapPlanDrilling";
|
||||||
|
|
||||||
[Post(BaseRoute)]
|
[Post(BaseRoute)]
|
||||||
Task<IApiResponse<int>> InsertRange(int idWell, [Body] IEnumerable<ProcessMapPlanDrillingDto> dtos);
|
Task<IApiResponse<int>> InsertRange(int idWell, [Body] IEnumerable<TDto> dtos);
|
||||||
|
|
||||||
[Post($"{BaseRoute}/replace")]
|
[Post($"{BaseRoute}/replace")]
|
||||||
Task<IApiResponse<int>> ClearAndInsertRange(int idWell, [Body] IEnumerable<ProcessMapPlanDrillingDto> dtos);
|
Task<IApiResponse<int>> ClearAndInsertRange(int idWell, [Body] IEnumerable<TDto> dtos);
|
||||||
|
|
||||||
[Delete(BaseRoute)]
|
[Delete(BaseRoute)]
|
||||||
Task<IApiResponse<int>> DeleteRange(int idWell, [Body] IEnumerable<int> ids);
|
Task<IApiResponse<int>> DeleteRange(int idWell, [Body] IEnumerable<int> ids);
|
||||||
@ -22,18 +22,24 @@ public interface IProcessMapPlanDrillingClient
|
|||||||
Task<IApiResponse<int>> Clear(int idWell);
|
Task<IApiResponse<int>> Clear(int idWell);
|
||||||
|
|
||||||
[Get(BaseRoute)]
|
[Get(BaseRoute)]
|
||||||
Task<IApiResponse<IEnumerable<ProcessMapPlanDrillingDto>>> Get(int idWell, ProcessMapPlanBaseRequest request);
|
Task<IApiResponse<IEnumerable<TDto>>> Get(int idWell);
|
||||||
|
|
||||||
|
[Get($"{BaseRoute}/history")]
|
||||||
|
Task<IApiResponse<IEnumerable<ChangeLogDto<TDto>>>> Get(int idWell, DateTimeOffset? moment);
|
||||||
|
|
||||||
|
[Get("/api/telemetry/{uid}/ProcessMapPlanDrilling")]
|
||||||
|
Task<IApiResponse<IEnumerable<ChangeLogDto<TDto>>>> Get(string uid, DateTimeOffset? updateFrom);
|
||||||
|
|
||||||
[Get($"{BaseRoute}/changeLog")]
|
[Get($"{BaseRoute}/changeLog")]
|
||||||
Task<IApiResponse<IEnumerable<ProcessMapPlanDrillingDto>>> GetChangeLog(int idWell, DateOnly? date);
|
Task<IApiResponse<IEnumerable<TDto>>> GetChangeLog(int idWell, DateOnly? date);
|
||||||
|
|
||||||
[Get($"{BaseRoute}/dates")]
|
[Get($"{BaseRoute}/dates")]
|
||||||
Task<IApiResponse<IEnumerable<DateOnly>>> GetDatesChange(int idWell);
|
Task<IApiResponse<IEnumerable<DateOnly>>> GetDatesChange(int idWell);
|
||||||
|
|
||||||
[Put(BaseRoute)]
|
[Put(BaseRoute)]
|
||||||
Task<IApiResponse<int>> UpdateOrInsertRange(int idWell, IEnumerable<ProcessMapPlanDrillingDto> dtos);
|
Task<IApiResponse<int>> UpdateOrInsertRange(int idWell, IEnumerable<TDto> dtos);
|
||||||
|
|
||||||
[Multipart]
|
[Multipart]
|
||||||
[Post(BaseRoute + "/parse")]
|
[Post(BaseRoute + "/parse")]
|
||||||
Task<IApiResponse<ParserResultDto<ProcessMapPlanDrillingDto>>> Parse(int idWell, [AliasAs("file")] StreamPart stream);
|
Task<IApiResponse<ParserResultDto<TDto>>> Parse(int idWell, [AliasAs("file")] StreamPart stream);
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -11,6 +11,8 @@ namespace AsbCloudWebApi.IntegrationTests.Data
|
|||||||
Hours = 1
|
Hours = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static string RemoteUid = "555-555-555";
|
||||||
|
|
||||||
public static Deposit[] Deposits => new Deposit[]
|
public static Deposit[] Deposits => new Deposit[]
|
||||||
{
|
{
|
||||||
new()
|
new()
|
||||||
@ -39,7 +41,7 @@ namespace AsbCloudWebApi.IntegrationTests.Data
|
|||||||
Timezone = Timezone,
|
Timezone = Timezone,
|
||||||
Telemetry = new Telemetry
|
Telemetry = new Telemetry
|
||||||
{
|
{
|
||||||
RemoteUid = "555-555-555",
|
RemoteUid = RemoteUid,
|
||||||
TimeZone = Timezone
|
TimeZone = Timezone
|
||||||
},
|
},
|
||||||
RelationCompaniesWells = new RelationCompanyWell[]
|
RelationCompaniesWells = new RelationCompanyWell[]
|
||||||
|
Loading…
Reference in New Issue
Block a user