Правка по результатам ревью-3

This commit is contained in:
Olga Nemt 2023-11-30 11:11:45 +05:00
parent 5ed11d8b47
commit 8fd9961da7
4 changed files with 20 additions and 8975 deletions

View File

@ -1,41 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Add_Permissions_For_Trajectory_Fact : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "t_permission",
columns: new[] { "id", "description", "name" },
values: new object[,]
{
{ 529, "Разрешение просматривать фактические траектории", "FactTrajectory.edit" },
});
migrationBuilder.InsertData(
table: "t_relation_user_role_permission",
columns: new[] { "id_permission", "id_user_role" },
values: new object[,]
{
{ 529, 1 },
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_relation_user_role_permission",
keyColumns: new[] { "id_permission", "id_user_role" },
keyValues: new object[] { 529, 1 });
migrationBuilder.DeleteData(
table: "t_permission",
keyColumn: "id",
keyValue: 529);
}
}
}

View File

@ -45,6 +45,12 @@ namespace AsbCloudInfrastructure.Repository
{
IdWell = idWell,
};
var result = await GetByRequestAsync(request, token);
return result;
}
public async Task<IEnumerable<TrajectoryGeoFactDto>> GetByRequestAsync(TrajectoryRequest request, CancellationToken token)
{
var entities = (await BuildQuery(request)
.Where(coord => coord.Deptsvym.HasValue &&
coord.Svyinc.HasValue &&
@ -66,10 +72,5 @@ namespace AsbCloudInfrastructure.Repository
return result;
}
public Task<IEnumerable<TrajectoryGeoFactDto>> GetByRequestAsync(TrajectoryRequest trajectoryRequest, CancellationToken cancellationToken)
{
throw new System.NotImplementedException();
}
}
}

View File

@ -6,6 +6,7 @@ using AsbCloudInfrastructure.Services.Trajectory.Export;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
@ -17,18 +18,18 @@ namespace AsbCloudWebApi.Controllers.Trajectory
/// </summary>
[ApiController]
[Authorize]
public abstract class TrajectoryController<Tdto> : ControllerBase
where Tdto : TrajectoryGeoDto
public abstract class TrajectoryController<TDto> : ControllerBase
where TDto : TrajectoryGeoDto
{
protected abstract string fileName { get; set; }
private readonly IWellService wellService;
private readonly TrajectoryExportService<Tdto> trajectoryExportService;
private readonly ITrajectoryRepository<Tdto> trajectoryRepository;
private readonly TrajectoryExportService<TDto> trajectoryExportService;
private readonly ITrajectoryRepository<TDto> trajectoryRepository;
public TrajectoryController(IWellService wellService,
TrajectoryExportService<Tdto> trajectoryExportService,
ITrajectoryRepository<Tdto> trajectoryRepository)
TrajectoryExportService<TDto> trajectoryExportService,
ITrajectoryRepository<TDto> trajectoryRepository)
{
this.trajectoryExportService = trajectoryExportService;
this.wellService = wellService;
@ -60,8 +61,8 @@ namespace AsbCloudWebApi.Controllers.Trajectory
/// <param name="idWell">ключ скважины</param>
/// <param name="token"> Токен отмены задачи </param>
/// <returns>Список добавленных координат траектории</returns>
//[ProducesResponseType(typeof(IEnumerable<Tdto>), (int)System.Net.HttpStatusCode.OK)]
public async Task<IActionResult> GetAsync(int idWell, CancellationToken token)
[HttpGet]
public async Task<ActionResult<IEnumerable<TDto>>> GetAsync(int idWell, CancellationToken token)
{
if (!await CanUserAccessToWellAsync(idWell,
token).ConfigureAwait(false))