forked from ddrilling/AsbCloudServer
#6539681 Удалил лишние референсы
This commit is contained in:
parent
6ab6da961a
commit
9644f73090
@ -157,5 +157,30 @@ namespace AsbCloudApp.Services
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<FileInfoDto> GetByMarkId(int idMark, CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// пометить метки файлов как удаленные
|
||||
/// </summary>
|
||||
/// <param name="idsMarks"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<int> MarkFileMarkAsDeletedAsync(IEnumerable<int> idsMarks, CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// Получение файлов по скважине
|
||||
/// </summary>
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<FileInfoDto>> GetInfosByWellIdAsync(int idWell, CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// Получить файлы определенной категории
|
||||
/// </summary>
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="idCategory"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<FileInfoDto>> GetInfosByCategoryAsync(int idWell, int idCategory, CancellationToken token);
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,6 @@ namespace AsbCloudInfrastructure
|
||||
services.AddTransient<IDrillParamsService, DrillParamsService>();
|
||||
services.AddTransient<IEventService, EventService>();
|
||||
services.AddTransient<IFileService, FileService>();
|
||||
services.AddTransient<IFileRepository, FileRepository>();
|
||||
services.AddTransient<IMeasureService, MeasureService>();
|
||||
services.AddTransient<IMessageService, MessageService>();
|
||||
services.AddTransient<IOperationsStatService, OperationsStatService>();
|
||||
@ -155,6 +154,7 @@ namespace AsbCloudInfrastructure
|
||||
dbSet => dbSet
|
||||
.Include(c => c.Wells)
|
||||
.Include(c => c.Deposit))); // может быть включен в сервис ClusterService
|
||||
services.AddTransient<IFileRepository, FileRepository>();
|
||||
// Subsystem service
|
||||
services.AddTransient<ICrudService<SubsystemDto>, CrudCacheServiceBase<SubsystemDto, Subsystem>>();
|
||||
services.AddTransient<ISubsystemService, SubsystemService>();
|
||||
|
@ -23,7 +23,6 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
|
||||
private readonly IFileService fileService;
|
||||
private readonly IUserService userService;
|
||||
private readonly IWellService wellService;
|
||||
private readonly IFileRepository fileRepository;
|
||||
private readonly IConfiguration configuration;
|
||||
private readonly IBackgroundWorkerService backgroundWorker;
|
||||
private readonly IEmailService emailService;
|
||||
@ -54,7 +53,6 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
|
||||
IFileService fileService,
|
||||
IUserService userService,
|
||||
IWellService wellService,
|
||||
IFileRepository fileRepository,
|
||||
IConfiguration configuration,
|
||||
IBackgroundWorkerService backgroundWorker,
|
||||
IEmailService emailService)
|
||||
@ -63,7 +61,6 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
|
||||
this.fileService = fileService;
|
||||
this.userService = userService;
|
||||
this.wellService = wellService;
|
||||
this.fileRepository = fileRepository;
|
||||
this.configuration = configuration;
|
||||
this.backgroundWorker = backgroundWorker;
|
||||
this.connectionString = configuration.GetConnectionString("DefaultConnection");
|
||||
@ -312,9 +309,9 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
|
||||
.Select(m => m.Id);
|
||||
|
||||
if (oldMarksIds?.Any() == true)
|
||||
await fileRepository.MarkFileMarkAsDeletedAsync(oldMarksIds, token);
|
||||
await fileService.MarkFileMarkAsDeletedAsync(oldMarksIds, token);
|
||||
|
||||
var result = await fileRepository.CreateFileMarkAsync(fileMarkDto, idUser, token)
|
||||
var result = await fileService.CreateFileMarkAsync(fileMarkDto, idUser, token)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
if (fileMarkDto.IdMarkType == idMarkTypeReject)
|
||||
@ -344,7 +341,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
|
||||
public async Task<int> MarkAsDeletedFileMarkAsync(int idMark,
|
||||
CancellationToken token)
|
||||
{
|
||||
var fileInfo = await fileRepository.GetByMarkId(idMark, token)
|
||||
var fileInfo = await fileService.GetByMarkId(idMark, token)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
if (fileInfo.IdCategory < idFileCategoryDrillingProgramPartsStart ||
|
||||
@ -483,6 +480,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
|
||||
.UseNpgsql(connectionString)
|
||||
.Options;
|
||||
using var context = new AsbCloudDbContext(contextOptions);
|
||||
var fileRepository = new FileRepository(context);
|
||||
var fileService = new FileService(fileRepository);
|
||||
var files = state.Parts.Select(p => fileService.GetUrl(p.File));
|
||||
DrillingProgramMaker.UniteExcelFiles(files, tempResultFilePath, state.Parts, well);
|
||||
|
@ -183,5 +183,17 @@ namespace AsbCloudInfrastructure.Services
|
||||
public async Task<FileInfoDto> GetByMarkId(int idMark, CancellationToken token)
|
||||
=> await fileRepository.GetByMarkId(idMark, token)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
public async Task<int> MarkFileMarkAsDeletedAsync(IEnumerable<int> idsMarks, CancellationToken token)
|
||||
=> await fileRepository.MarkFileMarkAsDeletedAsync(idsMarks, token)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
public async Task<IEnumerable<FileInfoDto>> GetInfosByWellIdAsync(int idWell, CancellationToken token)
|
||||
=> await fileRepository.GetInfosByWellIdAsync(idWell, token)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
public async Task<IEnumerable<FileInfoDto>> GetInfosByCategoryAsync(int idWell, int idCategory, CancellationToken token)
|
||||
=> await fileRepository.GetInfosByCategoryAsync(idWell, idCategory, token)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
@ -22,17 +22,15 @@ namespace AsbCloudInfrastructure.Services
|
||||
private readonly ITelemetryService telemetryService;
|
||||
private readonly IWellService wellService;
|
||||
private readonly IBackgroundWorkerService backgroundWorkerService;
|
||||
private readonly IFileRepository fileRepository;
|
||||
|
||||
public ReportService(IAsbCloudDbContext db, IConfiguration configuration,
|
||||
ITelemetryService telemetryService, IWellService wellService, IBackgroundWorkerService backgroundWorkerService, IFileRepository fileRepository)
|
||||
ITelemetryService telemetryService, IWellService wellService, IBackgroundWorkerService backgroundWorkerService)
|
||||
{
|
||||
this.db = db;
|
||||
this.connectionString = configuration.GetConnectionString("DefaultConnection");
|
||||
this.wellService = wellService;
|
||||
this.backgroundWorkerService = backgroundWorkerService;
|
||||
this.telemetryService = telemetryService;
|
||||
this.fileRepository = fileRepository;
|
||||
ReportCategoryId = db.FileCategories.AsNoTracking()
|
||||
.FirstOrDefault(c =>
|
||||
c.Name.Equals("Рапорт")).Id;
|
||||
@ -68,6 +66,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
};
|
||||
generator.Make(reportFileName);
|
||||
|
||||
var fileRepository = new FileRepository(context);
|
||||
var fileService = new FileService(fileRepository);
|
||||
var fileInfo = await fileService.MoveAsync(idWell, idUser, ReportCategoryId, reportFileName, reportFileName, token);
|
||||
|
||||
|
@ -28,7 +28,6 @@ namespace AsbCloudInfrastructure.Services
|
||||
private readonly IConfiguration configuration;
|
||||
private readonly IEmailService emailService;
|
||||
private readonly IFileCategoryService fileCategoryService;
|
||||
private readonly IFileRepository fileRepository;
|
||||
|
||||
private const int FileServiceThrewException = -1;
|
||||
|
||||
@ -38,8 +37,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
IWellService wellService,
|
||||
IConfiguration configuration,
|
||||
IEmailService emailService,
|
||||
IFileCategoryService fileCategoryService,
|
||||
IFileRepository fileRepository)
|
||||
IFileCategoryService fileCategoryService)
|
||||
{
|
||||
this.context = context;
|
||||
this.fileService = fileService;
|
||||
@ -48,7 +46,6 @@ namespace AsbCloudInfrastructure.Services
|
||||
this.configuration = configuration;
|
||||
this.emailService = emailService;
|
||||
this.fileCategoryService = fileCategoryService;
|
||||
this.fileRepository = fileRepository;
|
||||
}
|
||||
|
||||
public async Task<int> UpdateRangeAsync(int idWell, IEnumerable<WellFinalDocumentInputDto>? dtos, CancellationToken token)
|
||||
@ -98,7 +95,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
var categoriesIds = entitiesGroups
|
||||
.Select(g => g.Key);
|
||||
|
||||
var files = (await fileRepository
|
||||
var files = (await fileService
|
||||
.GetInfosByWellIdAsync(idWell, token)
|
||||
.ConfigureAwait(false))
|
||||
.Where(f => categoriesIds.Contains(f.IdCategory))
|
||||
@ -165,7 +162,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
|
||||
public async Task<WellFinalDocumentsHistoryDto> GetFilesHistoryByIdCategory(int idWell, int idCategory, CancellationToken token)
|
||||
{
|
||||
var files = await fileRepository.GetInfosByCategoryAsync(idWell, idCategory, token).ConfigureAwait(false);
|
||||
var files = await fileService.GetInfosByCategoryAsync(idWell, idCategory, token).ConfigureAwait(false);
|
||||
|
||||
return new WellFinalDocumentsHistoryDto {
|
||||
IdWell = idWell,
|
||||
|
@ -81,7 +81,6 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
||||
private readonly Mock<IFileService> fileServiceMock;
|
||||
private readonly Mock<IUserService> userServiceMock;
|
||||
private readonly Mock<IWellService> wellServiceMock;
|
||||
private readonly Mock<IFileRepository> fileRepository;
|
||||
private readonly Mock<IConfiguration> configurationMock;
|
||||
private readonly Mock<IBackgroundWorkerService> backgroundWorkerMock;
|
||||
private readonly Mock<IEmailService> emailService;
|
||||
@ -101,7 +100,6 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
||||
fileServiceMock = new Mock<IFileService>();
|
||||
userServiceMock = new Mock<IUserService>();
|
||||
wellServiceMock = new Mock<IWellService>();
|
||||
fileRepository = new Mock<IFileRepository>();
|
||||
configurationMock = new Mock<IConfiguration>();
|
||||
backgroundWorkerMock = new Mock<IBackgroundWorkerService>();
|
||||
}
|
||||
@ -114,7 +112,6 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
||||
fileServiceMock.Object,
|
||||
userServiceMock.Object,
|
||||
wellServiceMock.Object,
|
||||
fileRepository.Object,
|
||||
configurationMock.Object,
|
||||
backgroundWorkerMock.Object,
|
||||
emailService.Object);
|
||||
@ -132,7 +129,6 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
||||
fileServiceMock.Object,
|
||||
userServiceMock.Object,
|
||||
wellServiceMock.Object,
|
||||
fileRepository.Object,
|
||||
configurationMock.Object,
|
||||
backgroundWorkerMock.Object,
|
||||
emailService.Object);
|
||||
@ -152,7 +148,6 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
||||
fileServiceMock.Object,
|
||||
userServiceMock.Object,
|
||||
wellServiceMock.Object,
|
||||
fileRepository.Object,
|
||||
configurationMock.Object,
|
||||
backgroundWorkerMock.Object,
|
||||
emailService.Object);
|
||||
@ -176,7 +171,6 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
||||
fileServiceMock.Object,
|
||||
userServiceMock.Object,
|
||||
wellServiceMock.Object,
|
||||
fileRepository.Object,
|
||||
configurationMock.Object,
|
||||
backgroundWorkerMock.Object,
|
||||
emailService.Object);
|
||||
@ -212,7 +206,6 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
||||
fileServiceMock.Object,
|
||||
userServiceMock.Object,
|
||||
wellServiceMock.Object,
|
||||
fileRepository.Object,
|
||||
configurationMock.Object,
|
||||
backgroundWorkerMock.Object,
|
||||
emailService.Object);
|
||||
@ -239,7 +232,6 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
||||
fileServiceMock.Object,
|
||||
userServiceMock.Object,
|
||||
wellServiceMock.Object,
|
||||
fileRepository.Object,
|
||||
configurationMock.Object,
|
||||
backgroundWorkerMock.Object,
|
||||
emailService.Object);
|
||||
@ -271,7 +263,6 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
||||
fileServiceMock.Object,
|
||||
userServiceMock.Object,
|
||||
wellServiceMock.Object,
|
||||
fileRepository.Object,
|
||||
configurationMock.Object,
|
||||
backgroundWorkerMock.Object,
|
||||
emailService.Object);
|
||||
@ -310,7 +301,6 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
||||
fileServiceMock.Object,
|
||||
userServiceMock.Object,
|
||||
wellServiceMock.Object,
|
||||
fileRepository.Object,
|
||||
configurationMock.Object,
|
||||
backgroundWorkerMock.Object,
|
||||
emailService.Object);
|
||||
@ -338,7 +328,6 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
||||
fileServiceMock.Object,
|
||||
userServiceMock.Object,
|
||||
wellServiceMock.Object,
|
||||
fileRepository.Object,
|
||||
configurationMock.Object,
|
||||
backgroundWorkerMock.Object,
|
||||
emailService.Object);
|
||||
@ -366,7 +355,6 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
||||
fileServiceMock.Object,
|
||||
userServiceMock.Object,
|
||||
wellServiceMock.Object,
|
||||
fileRepository.Object,
|
||||
configurationMock.Object,
|
||||
backgroundWorkerMock.Object,
|
||||
emailService.Object);
|
||||
@ -397,7 +385,6 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
||||
fileServiceMock.Object,
|
||||
userServiceMock.Object,
|
||||
wellServiceMock.Object,
|
||||
fileRepository.Object,
|
||||
configurationMock.Object,
|
||||
backgroundWorkerMock.Object,
|
||||
emailService.Object);
|
||||
|
@ -23,7 +23,6 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
||||
private readonly Mock<IConfiguration> configurationMock;
|
||||
private readonly Mock<IEmailService> emailServiceMock;
|
||||
private readonly Mock<IFileCategoryService> fileCategoryService;
|
||||
private readonly Mock<IFileRepository> fileRepository;
|
||||
|
||||
private readonly IEnumerable<UserDto> users = new List<UserDto> {
|
||||
new UserDto {
|
||||
@ -53,7 +52,6 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
||||
configurationMock = new Mock<IConfiguration>();
|
||||
emailServiceMock = new Mock<IEmailService>();
|
||||
fileCategoryService = new Mock<IFileCategoryService>();
|
||||
fileRepository = new Mock<IFileRepository>();
|
||||
|
||||
service = new WellFinalDocumentsService(
|
||||
context: context,
|
||||
@ -62,8 +60,7 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
||||
wellService: wellServiceMock.Object,
|
||||
configuration: configurationMock.Object,
|
||||
emailService: emailServiceMock.Object,
|
||||
fileCategoryService: fileCategoryService.Object,
|
||||
fileRepository.Object);
|
||||
fileCategoryService: fileCategoryService.Object);
|
||||
}
|
||||
|
||||
~WellFinalDocumentsServiceTest()
|
||||
|
Loading…
Reference in New Issue
Block a user