refactor(all): Удалены из БД таблицы V1

This commit is contained in:
Mikhail Trubnikov
2023-10-18 09:40:13 +10:00
parent d720b70c4c
commit 0c688f7089
52 changed files with 2813 additions and 1980 deletions

View File

@@ -35,7 +35,7 @@ namespace PARR.DAL.Services.Implementations
// return null;
//}
return await EntitySet
.Include(t => t.ApplicationsInHosts).ThenInclude(a => a.Application).ThenInclude(t => t.ApplicationType)
.Include(t => t.ApplicationsInHosts).ThenInclude(a => a.Application).ThenInclude(t => t!.ApplicationType)
.AsSplitQuery()
.FirstOrDefaultAsync(h => h.IP == IP);
}

View File

@@ -1,25 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.V1;
namespace PARR.DAL.Services.Implementations.V1
{
internal class V1_ApplicationInHostService : BaseService<V1_ApplicationInHost>, V1_IApplicationInHostService
{
private readonly DataContext dataContext;
private readonly ILogger<V1_ApplicationInHostService> logger;
public V1_ApplicationInHostService(DataContext dataContext, ILogger<V1_ApplicationInHostService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<V1_ApplicationInHost> EntitySet => dataContext.V1_ApplicationsInHosts;
protected override DataContext EntitiContext => dataContext;
}
}

View File

@@ -1,30 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.V1;
namespace PARR.DAL.Services.Implementations.V1
{
internal class V1_ApplicationService : BaseService<V1_Application>, V1_IApplicationService
{
private readonly DataContext dataContext;
private readonly ILogger<V1_ApplicationService> logger;
public V1_ApplicationService(DataContext dataContext, ILogger<V1_ApplicationService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<V1_Application> EntitySet => dataContext.V1_Applications;
protected override DataContext EntitiContext => dataContext;
public async Task<V1_Application?> GetByNameAsync(string appName)
{
return await EntitySet.FirstOrDefaultAsync(t => t.Name.ToLower() == appName.Trim().ToLower());
}
}
}

View File

@@ -1,25 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.V1;
namespace PARR.DAL.Services.Implementations.V1
{
internal class V1_ApplicationTypeService : BaseService<V1_ApplicationType>, V1_IApplicationTypeService
{
private readonly DataContext dataContext;
private readonly ILogger<V1_ApplicationTypeService> logger;
public V1_ApplicationTypeService(DataContext dataContext, ILogger<V1_ApplicationTypeService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<V1_ApplicationType> EntitySet => dataContext.V1_ApplicationTypes;
protected override DataContext EntitiContext => dataContext;
}
}

View File

@@ -1,143 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.DomainModels;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.V1;
namespace PARR.DAL.Services.Implementations.V1
{
internal class V1_HostService : BaseService<V1_Host>, V1_IHostService
{
private readonly DataContext dataContext;
private readonly ILogger<V1_HostService> logger;
protected override DbSet<V1_Host> EntitySet => dataContext.V1_Hosts;
protected override DataContext EntitiContext => dataContext;
public V1_HostService(DataContext dataContext, ILogger<V1_HostService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
public async Task<V1_Host?> GetHostWithAppsAsync(string IP, string RegionalEK)
{
//try
//{
// var host = await EntitySet.FirstAsync(h => h.IP == IP && h.RegionalEK == RegionalEK);
// return host;
//}
//catch
//{
// logger.LogInformation($"Не найден узел с IP адресом {IP} и региональным ЭК {RegionalEK}");
// return null;
//}
return await EntitySet
.Include(t => t.ApplicationsInHosts).ThenInclude(a => a.Application).ThenInclude(t => t.ApplicationType)
.AsSplitQuery()
.FirstOrDefaultAsync(h => h.IP == IP && h.RegionalEK == RegionalEK);
}
public async Task<V1_Host?> GetHostWithAppsAsync(string IP, string linkEK, string regionalEK)
{
return await EntitySet
.Include(t => t.ApplicationsInHosts).ThenInclude(a => a.Application).ThenInclude(t => t.ApplicationType)
.AsSplitQuery()
.FirstOrDefaultAsync(h => h.IP == IP && h.LinkEK == linkEK && h.RegionalEK == regionalEK);
}
public async Task<V1_Host?> GetHostByIPAndRegionalEKAsync(string IP, string RegionalEK)
{
return await EntitySet.FirstOrDefaultAsync(h => h.IP == IP && h.RegionalEK == RegionalEK);
}
public Task<V1_Host?> GetAsync(Guid id)
{
throw new NotImplementedException();
}
public IQueryable<V1_Host> Get()
{
throw new NotImplementedException();
}
public IQueryable<V1_Host> GetPage(IQueryable<V1_Host> query, PaginationFilter paginationFilter)
{
throw new NotImplementedException();
}
public Task<bool> CreateAsync(V1_Host obj)
{
throw new NotImplementedException();
}
public Task<bool> AddRangeAsync(List<V1_Host> objs)
{
throw new NotImplementedException();
}
public Task<bool> DeleteAsync(Guid id)
{
throw new NotImplementedException();
}
public bool Delete(V1_Host obj)
{
throw new NotImplementedException();
}
public Task<bool> CommitAsync()
{
throw new NotImplementedException();
}
//public async Task<Host?> GetHostByRegionalEKAsync(string RegionalEK)И
//{
// try
// {
// var host = await EntitySet.FirstAsync(h => h.RegionalEK == RegionalEK);
// return host;
// }
// catch
// {
// logger.LogInformation($"Не найден узел с региональным ЭК {RegionalEK}");
// return null;
// }
//}
//public async Task<bool> UpdateAsync(Host host)
//{
// var orig = await EntitySet.FirstAsync(h => h.IP == host.IP);
// if (orig == null)
// return false;
// orig.DateModified = DateTimeOffset.UtcNow;
// orig.HostName = host.HostName;
// orig.RegionalEK = host.RegionalEK;
// orig.LinkEK = host.LinkEK;
// orig.Status = host.Status;
// orig.WorkGroup = host.WorkGroup;
// orig.Responsible = host.Responsible;
// orig.OS = host.OS;
// orig.DB = host.DB;
// orig.APP = host.APP;
// if (!await CommitAsync())
// {
// logger.LogError($"Ошибка обновления узла {host.IP}");
// return false;
// }
// else
// {
// logger.LogInformation($"Обновлен узел {host.IP}");
// return true;
// }
//}
}
}

View File

@@ -1,24 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.V1;
namespace PARR.DAL.Services.Implementations.V1
{
internal class V1_JobCategoryService : BaseService<V1_JobCategory>, V1_IJobCategoryService
{
private readonly DataContext dataContext;
private readonly ILogger<V1_JobCategoryService> logger;
public V1_JobCategoryService(DataContext dataContext, ILogger<V1_JobCategoryService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<V1_JobCategory> EntitySet => dataContext.JobCategories;
protected override DataContext EntitiContext => dataContext;
}
}

View File

@@ -1,41 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Extensions;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.V1;
namespace PARR.DAL.Services.Implementations.V1
{
internal class V1_JobJournalService : BaseService<V1_JobJournal>, V1_IJobJournalService
{
private readonly DataContext dataContext;
private readonly ILogger<V1_JobJournalService> logger;
public V1_JobJournalService(DataContext dataContext, ILogger<V1_JobJournalService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<V1_JobJournal> EntitySet => dataContext.JobJournals;
protected override DataContext EntitiContext => dataContext;
public async Task<V1_JobJournal?> GetLastAsync(Guid jobId, Guid hostId, DateTimeOffset date)
{
//var n=DateTimeOffset.UtcNow;
//var opers = await EntitySet
// .Where(j => j.JobId == jobId && j.HostId == hostId && (j.DateOper!=DateTimeOffset.MinValue))/*date.StartOfDay()*/// && j.DateOper < date.EndOfDay()))
// .OrderBy(t => t.DateOper)
// .LastOrDefaultAsync();
var opers = await EntitySet
.Where(j => j.JobId == jobId && j.HostId == hostId && j.DateOper.DateTime.Date == date.DateTime.Date)
.OrderBy(t => t.DateOper)
.LastOrDefaultAsync();
return opers;
}
}
}

View File

@@ -1,24 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.V1;
namespace PARR.DAL.Services.Implementations.V1
{
internal class V1_JobModeService : BaseService<V1_JobMode>, V1_IJobModeService
{
private readonly DataContext dataContext;
private readonly ILogger<V1_JobModeService> logger;
public V1_JobModeService(DataContext dataContext, ILogger<V1_JobModeService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<V1_JobMode> EntitySet => dataContext.JobModes;
protected override DataContext EntitiContext => dataContext;
}
}

View File

@@ -1,30 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.V1;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PARR.DAL.Services.Implementations.V1
{
internal class V1_JobService : BaseService<V1_Job>, V1_IJobService
{
private readonly DataContext dataContext;
private readonly ILogger<V1_JobService> logger;
public V1_JobService(DataContext dataContext, ILogger<V1_JobService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<V1_Job> EntitySet => dataContext.Jobs;
protected override DataContext EntitiContext => dataContext;
}
}

View File

@@ -1,24 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.V1;
namespace PARR.DAL.Services.Implementations.V1
{
internal class V1_JobStatusService : BaseService<V1_JobStatus>, V1_IJobStatusService
{
private readonly DataContext dataContext;
private readonly ILogger<V1_JobStatusService> logger;
public V1_JobStatusService(DataContext dataContext, ILogger<V1_JobStatusService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<V1_JobStatus> EntitySet => dataContext.JobStatuses;
protected override DataContext EntitiContext => dataContext;
}
}

View File

@@ -1,22 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces;
namespace PARR.DAL.Services.Implementations.V1
{
//internal class SchedulerService : BaseService<Scheduler>, ISchedulerService
//{
// private readonly DataContext dataContext;
// public SchedulerService(DataContext dataContext, ILogger<SchedulerService> logger) : base(logger)
// {
// this.dataContext = dataContext;
// }
// protected override DbSet<Scheduler> EntitySet => dataContext.Schedulers;
// protected override DataContext EntitiContext => dataContext;
//}
}

View File

@@ -1,5 +1,4 @@
using PARR.DAL.Models;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces

View File

@@ -1,9 +0,0 @@
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.V1
{
public interface V1_IApplicationInHostService : IBaseService<V1_ApplicationInHost>
{
}
}

View File

@@ -1,10 +0,0 @@
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.V1
{
public interface V1_IApplicationService : IBaseService<V1_Application>
{
Task<V1_Application?> GetByNameAsync(string appName);
}
}

View File

@@ -1,9 +0,0 @@
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.V1
{
public interface V1_IApplicationTypeService : IBaseService<V1_ApplicationType>
{
}
}

View File

@@ -1,14 +0,0 @@
using PARR.DAL.Models;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.V1
{
public interface V1_IHostService : IBaseService<V1_Host>
{
Task<V1_Host?> GetHostByIPAndRegionalEKAsync(string IP, string RegionalEK);
Task<V1_Host?> GetHostWithAppsAsync(string IP, string linkEK, string regionalEK);
//Task<Host?> GetHostByRegionalEKAsync(string LinkEK);
//Task<bool> UpdateAsync(Host host);
}
}

View File

@@ -1,9 +0,0 @@
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.V1
{
internal interface V1_IJobCategoryService : IBaseService<V1_JobCategory>
{
}
}

View File

@@ -1,9 +0,0 @@
using PARR.DAL.Models.V1;
namespace PARR.DAL.Services.Interfaces.V1
{
public interface V1_IJobJournalService
{
Task<V1_JobJournal?> GetLastAsync(Guid jobId, Guid hostId, DateTimeOffset date);
}
}

View File

@@ -1,9 +0,0 @@
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.V1
{
internal interface V1_IJobModeService : IBaseService<V1_JobMode>
{
}
}

View File

@@ -1,9 +0,0 @@
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.V1
{
public interface V1_IJobService : IBaseService<V1_Job>
{
}
}

View File

@@ -1,9 +0,0 @@
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.V1
{
internal interface V1_IJobStatusService : IBaseService<V1_JobStatus>
{
}
}

View File

@@ -1,9 +0,0 @@
using PARR.DAL.Models;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.V1
{
//public interface V1_ISchedulerService : IBaseService<V1_Scheduler>
//{
//}
}