Добавлен префикс таблицам первой структуры базы

This commit is contained in:
Mikhail Kuznetsov
2023-08-10 10:14:41 +10:00
parent f3538fdd5d
commit 39b1333969
38 changed files with 157 additions and 450 deletions

View File

@@ -1,4 +1,5 @@
using AutoMapper; using AutoMapper;
using PARR.DAL.Models.V1;
using System.Xml; using System.Xml;
namespace PARR.AIHIT.MappingProfiles namespace PARR.AIHIT.MappingProfiles
@@ -7,7 +8,7 @@ namespace PARR.AIHIT.MappingProfiles
{ {
public RequestToDomain() public RequestToDomain()
{ {
CreateMap<XmlNode, PARR.DAL.Models.Host>() CreateMap<XmlNode, V1_Host>()
.ForMember(d => d.HostName, o => o.MapFrom(s => (s.Attributes!["ХОСТ"] != null) ? s.Attributes!["ХОСТ"]!.Value.Trim() : "")) .ForMember(d => d.HostName, o => o.MapFrom(s => (s.Attributes!["ХОСТ"] != null) ? s.Attributes!["ХОСТ"]!.Value.Trim() : ""))
.ForMember(d => d.IP, o => o.MapFrom(s => s.Attributes!["IP_АДРЕС"]!.Value.Trim())) .ForMember(d => d.IP, o => o.MapFrom(s => s.Attributes!["IP_АДРЕС"]!.Value.Trim()))
.ForMember(d => d.RegionalEK, o => o.MapFrom(s => s.Attributes!["РЕГИОНАЛЬНЫЙ_ЭК"]!.Value.Trim())) .ForMember(d => d.RegionalEK, o => o.MapFrom(s => s.Attributes!["РЕГИОНАЛЬНЫЙ_ЭК"]!.Value.Trim()))

View File

@@ -25,7 +25,7 @@ namespace PARR.AIHIT
private readonly IApplicationTypeService appTypeService; private readonly IApplicationTypeService appTypeService;
private readonly IApplicationInHostService appInHostService; private readonly IApplicationInHostService appInHostService;
public List<ApplicationType> AppTypes { get; private set; } = new List<ApplicationType>(); public List<V1_ApplicationType> AppTypes { get; private set; } = new List<V1_ApplicationType>();
public Syncher( public Syncher(
ILogger<Syncher> logger, ILogger<Syncher> logger,
@@ -97,7 +97,7 @@ namespace PARR.AIHIT
// var foundHost = await hostService.GetHostAsync(ip, linkEK, regionalEK); // var foundHost = await hostService.GetHostAsync(ip, linkEK, regionalEK);
var foundHost = await hostService.GetHostWithAppsAsync(ip, linkEK, regionalEK); var foundHost = await hostService.GetHostWithAppsAsync(ip, linkEK, regionalEK);
var mappedHost = mapper.Map<Host>(vm); var mappedHost = mapper.Map<V1_Host>(vm);
var hostApplications = await GetAndFillApplicationsAsync(vm); var hostApplications = await GetAndFillApplicationsAsync(vm);
@@ -209,7 +209,7 @@ namespace PARR.AIHIT
} }
} }
private async Task SyncApplicationAndHostAsync(Host? host, List<Application> hostApplications, bool isUpdateDateModified = false) private async Task SyncApplicationAndHostAsync(V1_Host? host, List<V1_Application> hostApplications, bool isUpdateDateModified = false)
{ {
var isUpdated = false; var isUpdated = false;
if (host == null) if (host == null)
@@ -226,7 +226,7 @@ namespace PARR.AIHIT
//add //add
logger.LogInformation($"Host: {host.Id}, {host.LinkEK} добавление нового приложения Application {changedHostApp.Name}"); logger.LogInformation($"Host: {host.Id}, {host.LinkEK} добавление нового приложения Application {changedHostApp.Name}");
var newAppHost = new ApplicationInHost { Id = Guid.NewGuid(), ApplicationId = changedHostApp.Id, HostId = host.Id }; var newAppHost = new V1_ApplicationInHost { Id = Guid.NewGuid(), ApplicationId = changedHostApp.Id, HostId = host.Id };
if (!await appInHostService.CreateAsync(newAppHost)) if (!await appInHostService.CreateAsync(newAppHost))
logger.LogError($"Не удалось создать ApplicationInHost {changedHostApp.Name}, host: {host.Id}, {host.LinkEK}"); logger.LogError($"Не удалось создать ApplicationInHost {changedHostApp.Name}, host: {host.Id}, {host.LinkEK}");
@@ -262,10 +262,10 @@ namespace PARR.AIHIT
} }
private async Task<List<Application>> GetAndFillApplicationsAsync(XmlNode vm) private async Task<List<V1_Application>> GetAndFillApplicationsAsync(XmlNode vm)
{ {
logger.LogInformation($"--- Начало парсинга данных о программном обеспечении(СП, БД, ОС) из Xml документа от АИХ ИТ ---"); logger.LogInformation($"--- Начало парсинга данных о программном обеспечении(СП, БД, ОС) из Xml документа от АИХ ИТ ---");
var applications = new List<Application>(); var applications = new List<V1_Application>();
//TODO GetAppFromXML(vm?.Attributes?["СП"]?.Value).ForEach(async item => await CreateAppIfNotExistAsync(item, ApplicationTypesEnum.APP)); //TODO GetAppFromXML(vm?.Attributes?["СП"]?.Value).ForEach(async item => await CreateAppIfNotExistAsync(item, ApplicationTypesEnum.APP));
//GetDBFromXML(vm?.Attributes?["СУБД"]?.Value).ForEach(async item => await CreateAppIfNotExistAsync(item, ApplicationTypesEnum.DB)); //GetDBFromXML(vm?.Attributes?["СУБД"]?.Value).ForEach(async item => await CreateAppIfNotExistAsync(item, ApplicationTypesEnum.DB));
@@ -330,7 +330,7 @@ namespace PARR.AIHIT
return osList; return osList;
} }
private async Task<Application?> CreateAppIfNotExistAsync(string appName, ApplicationTypesEnum type)//Application application) private async Task<V1_Application?> CreateAppIfNotExistAsync(string appName, ApplicationTypesEnum type)//Application application)
{ {
if (string.IsNullOrEmpty(appName) || string.IsNullOrWhiteSpace(appName)) return null; if (string.IsNullOrEmpty(appName) || string.IsNullOrWhiteSpace(appName)) return null;
@@ -346,7 +346,7 @@ namespace PARR.AIHIT
return null; return null;
} }
var app = new DAL.Models.Application var app = new DAL.Models.V1_Application
{ {
Id = Guid.NewGuid(), Id = Guid.NewGuid(),
Name = appName.Trim(), Name = appName.Trim(),
@@ -361,7 +361,7 @@ namespace PARR.AIHIT
return await appService.GetAsync(app.Id); return await appService.GetAsync(app.Id);
} }
private ApplicationType? GetAppTypeByName(ApplicationTypesEnum type) private V1_ApplicationType? GetAppTypeByName(ApplicationTypesEnum type)
{ {
var existType = AppTypes.FirstOrDefault(t => t.Name == type.ToString()); var existType = AppTypes.FirstOrDefault(t => t.Name == type.ToString());
if (existType == null) if (existType == null)

View File

@@ -9,7 +9,7 @@ using PARR.API.Controllers.V1.Base;
using PARR.API.Extensions; using PARR.API.Extensions;
using PARR.API.Services.Interfaces; using PARR.API.Services.Interfaces;
using PARR.DAL.DomainModels; using PARR.DAL.DomainModels;
using PARR.DAL.Models; using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces; using PARR.DAL.Services.Interfaces;
namespace PARR.API.Controllers.V1 namespace PARR.API.Controllers.V1
@@ -49,7 +49,7 @@ namespace PARR.API.Controllers.V1
public async Task<IActionResult> GetAll([FromQuery] PaginationQuery paginationQuery, [FromQuery] JobGetAllQuery filter) public async Task<IActionResult> GetAll([FromQuery] PaginationQuery paginationQuery, [FromQuery] JobGetAllQuery filter)
{ {
var paginationFilter = mapper.Map<PaginationFilter>(paginationQuery); var paginationFilter = mapper.Map<PaginationFilter>(paginationQuery);
IQueryable<Job> query = jobService.Get().Include(t => t.JobMode).OrderBy(s => s.StartAt); IQueryable<V1_Job> query = jobService.Get().Include(t => t.JobMode).OrderBy(s => s.StartAt);
if (filter.IsEnabled.HasValue) if (filter.IsEnabled.HasValue)
query = query.Where(t => t.IsEnabled == filter.IsEnabled); query = query.Where(t => t.IsEnabled == filter.IsEnabled);
@@ -86,7 +86,7 @@ namespace PARR.API.Controllers.V1
// С одним IP может быть несколько информационных систем, соответственного а таблице храниться несколько записей хостов с одинаковым IP // С одним IP может быть несколько информационных систем, соответственного а таблице храниться несколько записей хостов с одинаковым IP
var hosts = await hostService.Get().Where(h => h.IP == ip).ToListAsync(); var hosts = await hostService.Get().Where(h => h.IP == ip).ToListAsync();
var hostJobsDict = new Dictionary<DAL.Models.Host, List<Job>>(); var hostJobsDict = new Dictionary<V1_Host, List<V1_Job>>();
foreach (var host in hosts) foreach (var host in hosts)
{ {
var jobsHost = await jobService.Get() var jobsHost = await jobService.Get()
@@ -102,8 +102,8 @@ namespace PARR.API.Controllers.V1
} }
} }
var jobsList = new List<Job>(); var jobsList = new List<V1_Job>();
var jobsToResponse = new List<Job>(); var jobsToResponse = new List<V1_Job>();
foreach (var hostAndJobs in hostJobsDict) foreach (var hostAndJobs in hostJobsDict)
{ {
@@ -146,9 +146,9 @@ namespace PARR.API.Controllers.V1
} }
private async Task<List<Job>> GetListJobsAsync(Job job, DAL.Models.Host host, DateTimeOffset queryDate) private async Task<List<V1_Job>> GetListJobsAsync(V1_Job job, V1_Host host, DateTimeOffset queryDate)
{ {
var jobs = new List<Job>(); var jobs = new List<V1_Job>();
#region description #region description
// freaq > суток или нет? // freaq > суток или нет?
@@ -182,7 +182,7 @@ namespace PARR.API.Controllers.V1
// если в истории нет записей, то запускаем сегодня в стартЭт // если в истории нет записей, то запускаем сегодня в стартЭт
// берем квери дэйт и ем задаем время из Джобс СтартЭт // берем квери дэйт и ем задаем время из Джобс СтартЭт
var startDateTimeNext = new DateTimeOffset(queryDate.Year, queryDate.Month, queryDate.Day, job.StartAt.Hour, job.StartAt.Minute, job.StartAt.Second, new TimeSpan(0)); var startDateTimeNext = new DateTimeOffset(queryDate.Year, queryDate.Month, queryDate.Day, job.StartAt.Hour, job.StartAt.Minute, job.StartAt.Second, new TimeSpan(0));
var jobToAdded = mapper.Map<Job>(job);//new Job { StartAt = startDateTimeNext }; var jobToAdded = mapper.Map<V1_Job>(job);//new Job { StartAt = startDateTimeNext };
jobToAdded.StartAt = startDateTimeNext; jobToAdded.StartAt = startDateTimeNext;
jobs.Add(jobToAdded); jobs.Add(jobToAdded);
@@ -195,7 +195,7 @@ namespace PARR.API.Controllers.V1
// если берем прошлую последнюю операцию из журнала, и к ней прибавить фрекунси, то время следующего старта сдвинется на время выполнения прошлого задания // если берем прошлую последнюю операцию из журнала, и к ней прибавить фрекунси, то время следующего старта сдвинется на время выполнения прошлого задания
// чтобы это избежать, берем квери дэйт и ем задаем время из Джобс СтартЭт // чтобы это избежать, берем квери дэйт и ем задаем время из Джобс СтартЭт
var startDateTimeNext = new DateTimeOffset(queryDate.Year, queryDate.Month, queryDate.Day, job.StartAt.Hour, job.StartAt.Minute, job.StartAt.Second, new TimeSpan(0)); var startDateTimeNext = new DateTimeOffset(queryDate.Year, queryDate.Month, queryDate.Day, job.StartAt.Hour, job.StartAt.Minute, job.StartAt.Second, new TimeSpan(0));
var jobToAdded = mapper.Map<Job>(job); var jobToAdded = mapper.Map<V1_Job>(job);
jobToAdded.StartAt = startDateTimeNext; jobToAdded.StartAt = startDateTimeNext;
jobs.Add(jobToAdded); jobs.Add(jobToAdded);
} }
@@ -214,7 +214,7 @@ namespace PARR.API.Controllers.V1
while (min >= 0) while (min >= 0)
{ {
//var jobToAdded = new Job { StartAt = queryDate.StartOfDay().AddMinutes(min) }; //var jobToAdded = new Job { StartAt = queryDate.StartOfDay().AddMinutes(min) };
var jobToAdded = mapper.Map<Job>(job); var jobToAdded = mapper.Map<V1_Job>(job);
jobToAdded.StartAt = queryDate.StartOfDay().AddMinutes(min); jobToAdded.StartAt = queryDate.StartOfDay().AddMinutes(min);
jobs.Add(jobToAdded); jobs.Add(jobToAdded);
min = min - job.Frequency; min = min - job.Frequency;
@@ -225,7 +225,7 @@ namespace PARR.API.Controllers.V1
while (min < allDayMinutes) while (min < allDayMinutes)
{ {
//var jobToAdded = new Job { StartAt = queryDate.StartOfDay().AddMinutes(min) }; //var jobToAdded = new Job { StartAt = queryDate.StartOfDay().AddMinutes(min) };
var jobToAdded = mapper.Map<Job>(job); var jobToAdded = mapper.Map<V1_Job>(job);
jobToAdded.StartAt = queryDate.StartOfDay().AddMinutes(min); jobToAdded.StartAt = queryDate.StartOfDay().AddMinutes(min);
jobs.Add(jobToAdded); jobs.Add(jobToAdded);
min = min + job.Frequency; min = min + job.Frequency;
@@ -239,7 +239,7 @@ namespace PARR.API.Controllers.V1
while (min < allDayMinutes) while (min < allDayMinutes)
{ {
//var jobToAdded = new Job { StartAt = queryDate.StartOfDay().AddMinutes(min) }; //var jobToAdded = new Job { StartAt = queryDate.StartOfDay().AddMinutes(min) };
var jobToAdded = mapper.Map<Job>(job); var jobToAdded = mapper.Map<V1_Job>(job);
jobToAdded.StartAt = queryDate.StartOfDay().AddMinutes(min); jobToAdded.StartAt = queryDate.StartOfDay().AddMinutes(min);
jobs.Add(jobToAdded); jobs.Add(jobToAdded);
min = min + job.Frequency; min = min + job.Frequency;

View File

@@ -1,5 +1,5 @@
using AutoMapper; using AutoMapper;
using PARR.DAL.Models; using PARR.DAL.Models.V1;
namespace PARR.API.MappingProfiles namespace PARR.API.MappingProfiles
{ {
@@ -7,7 +7,7 @@ namespace PARR.API.MappingProfiles
{ {
public DomainToDomainProfile() public DomainToDomainProfile()
{ {
CreateMap<Job, Job>(); CreateMap<V1_Job, V1_Job>();
} }
} }
} }

View File

@@ -1,6 +1,6 @@
using AutoMapper; using AutoMapper;
using PARR.API.Contracts.V1.Responses; using PARR.API.Contracts.V1.Responses;
using PARR.DAL.Models; using PARR.DAL.Models.V1;
namespace PARR.API.MappingProfiles namespace PARR.API.MappingProfiles
{ {
@@ -9,23 +9,23 @@ namespace PARR.API.MappingProfiles
public DomainToResponseProfile() public DomainToResponseProfile()
{ {
// --- Job --- // --- Job ---
CreateMap<Job, JobBaseResponse>() CreateMap<V1_Job, JobBaseResponse>()
.Include<Job, JobGetAllResponse>() .Include<V1_Job, JobGetAllResponse>()
.ForMember(d => d.FrequencyMinute, o => o.MapFrom(s => s.Frequency)) .ForMember(d => d.FrequencyMinute, o => o.MapFrom(s => s.Frequency))
.ForMember(d => d.Script, o => o.MapFrom(s => s.ScriptName)); .ForMember(d => d.Script, o => o.MapFrom(s => s.ScriptName));
CreateMap<Job, JobGetAllResponse>(); CreateMap<V1_Job, JobGetAllResponse>();
CreateMap<List<Job>, JobMinResponse>() CreateMap<List<V1_Job>, JobMinResponse>()
.ForMember(d => d.Scheduled, o => o.MapFrom(s => s)); .ForMember(d => d.Scheduled, o => o.MapFrom(s => s));
CreateMap<Job, JobMinScheduleResponse>() CreateMap<V1_Job, JobMinScheduleResponse>()
.ForMember(d => d.Script, o => o.MapFrom(s => s.ScriptName)); .ForMember(d => d.Script, o => o.MapFrom(s => s.ScriptName));
// === Job === // === Job ===
CreateMap<JobMode, JobModeResponse>(); CreateMap<V1_JobMode, JobModeResponse>();
} }
} }
} }

View File

@@ -8,16 +8,16 @@ namespace PARR.DAL.Context
{ {
public DataContext(DbContextOptions<DataContext> options) : base(options) { } public DataContext(DbContextOptions<DataContext> options) : base(options) { }
public DbSet<JobType> JobTypes { get; set; } public DbSet<V1_JobType> JobTypes { get; set; }
public DbSet<JobCategory> JobCategories { get; set; } public DbSet<V1_JobCategory> JobCategories { get; set; }
public DbSet<JobMode> JobModes { get; set; } public DbSet<V1_JobMode> JobModes { get; set; }
public DbSet<JobStatus> JobStatuses { get; set; } public DbSet<V1_JobStatus> JobStatuses { get; set; }
public DbSet<Host> Hosts { get; set; } public DbSet<V1_Host> Hosts { get; set; }
public DbSet<Job> Jobs { get; set; } public DbSet<V1_Job> Jobs { get; set; }
public DbSet<JobJournal> JobJournals { get; set; } public DbSet<V1_JobJournal> JobJournals { get; set; }
public DbSet<Application> Applications { get; set; } public DbSet<V1_Application> Applications { get; set; }
public DbSet<ApplicationType> ApplicationTypes { get; set; } public DbSet<V1_ApplicationType> ApplicationTypes { get; set; }
public DbSet<ApplicationInHost> ApplicationsInHosts { get; set; } public DbSet<V1_ApplicationInHost> ApplicationsInHosts { get; set; }
//public DbSet<Scheduler> Schedulers { get; set; } //public DbSet<Scheduler> Schedulers { get; set; }
//todo init application type+check migrations //todo init application type+check migrations
@@ -28,7 +28,7 @@ namespace PARR.DAL.Context
var dateCreated = new DateTimeOffset(2023, 05, 01, 0, 0, 0, new TimeSpan(0)); var dateCreated = new DateTimeOffset(2023, 05, 01, 0, 0, 0, new TimeSpan(0));
modelBuilder.Entity<JobMode>(f => modelBuilder.Entity<V1_JobMode>(f =>
{ {
f.HasData( f.HasData(
new() { Id = new Guid("FBA4202C-5BAD-49C4-B076-D1CA6E1FB158"), DateCreated = dateCreated, DateModified = null, Name = JobModeEnum.auto.ToString() }, new() { Id = new Guid("FBA4202C-5BAD-49C4-B076-D1CA6E1FB158"), DateCreated = dateCreated, DateModified = null, Name = JobModeEnum.auto.ToString() },
@@ -36,7 +36,7 @@ namespace PARR.DAL.Context
); );
}); });
modelBuilder.Entity<JobStatus>(f => modelBuilder.Entity<V1_JobStatus>(f =>
{ {
f.HasData( f.HasData(
new() { Id = new Guid("EDEF6DC3-ADAD-4C77-8AD1-63BB9052355A"), DateCreated = dateCreated, DateModified = null, Name = JobStatusEnum.started.ToString(), Description = "Задание запущено" }, new() { Id = new Guid("EDEF6DC3-ADAD-4C77-8AD1-63BB9052355A"), DateCreated = dateCreated, DateModified = null, Name = JobStatusEnum.started.ToString(), Description = "Задание запущено" },
@@ -45,7 +45,7 @@ namespace PARR.DAL.Context
}); });
modelBuilder.Entity<ApplicationType>(f => modelBuilder.Entity<V1_ApplicationType>(f =>
{ {
f.HasData( f.HasData(
new() { Id = new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"), DateCreated = dateCreated, DateModified = null, Name = ApplicationTypesEnum.APP.ToString(), Description = "Поле СП xml АИХ ИТ" }, new() { Id = new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"), DateCreated = dateCreated, DateModified = null, Name = ApplicationTypesEnum.APP.ToString(), Description = "Поле СП xml АИХ ИТ" },

View File

@@ -78,7 +78,7 @@ namespace PARR.DAL.Migrations
b.ToTable("ApplicationsInHosts"); b.ToTable("ApplicationsInHosts");
}); });
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b => modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -392,13 +392,13 @@ namespace PARR.DAL.Migrations
modelBuilder.Entity("PARR.DAL.Models.Application", b => modelBuilder.Entity("PARR.DAL.Models.Application", b =>
{ {
b.HasOne("PARR.DAL.Models.ApplicationType", "ApplicationType") b.HasOne("PARR.DAL.Models.V1_ApplicationType", "V1_ApplicationType")
.WithMany() .WithMany()
.HasForeignKey("ApplicationTypeId") .HasForeignKey("ApplicationTypeId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("ApplicationType"); b.Navigation("V1_ApplicationType");
}); });
modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b => modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b =>
@@ -420,9 +420,9 @@ namespace PARR.DAL.Migrations
b.Navigation("Host"); b.Navigation("Host");
}); });
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b => modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
{ {
b.HasOne("PARR.DAL.Models.ApplicationType", null) b.HasOne("PARR.DAL.Models.V1_ApplicationType", null)
.WithMany("ApplicationTypes") .WithMany("ApplicationTypes")
.HasForeignKey("ApplicationTypeId"); .HasForeignKey("ApplicationTypeId");
}); });
@@ -492,7 +492,7 @@ namespace PARR.DAL.Migrations
b.Navigation("ApplicationsInHosts"); b.Navigation("ApplicationsInHosts");
}); });
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b => modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
{ {
b.Navigation("ApplicationTypes"); b.Navigation("ApplicationTypes");
}); });

View File

@@ -78,7 +78,7 @@ namespace PARR.DAL.Migrations
b.ToTable("ApplicationsInHosts"); b.ToTable("ApplicationsInHosts");
}); });
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b => modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -392,13 +392,13 @@ namespace PARR.DAL.Migrations
modelBuilder.Entity("PARR.DAL.Models.Application", b => modelBuilder.Entity("PARR.DAL.Models.Application", b =>
{ {
b.HasOne("PARR.DAL.Models.ApplicationType", "ApplicationType") b.HasOne("PARR.DAL.Models.V1_ApplicationType", "V1_ApplicationType")
.WithMany() .WithMany()
.HasForeignKey("ApplicationTypeId") .HasForeignKey("ApplicationTypeId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("ApplicationType"); b.Navigation("V1_ApplicationType");
}); });
modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b => modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b =>
@@ -420,9 +420,9 @@ namespace PARR.DAL.Migrations
b.Navigation("Host"); b.Navigation("Host");
}); });
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b => modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
{ {
b.HasOne("PARR.DAL.Models.ApplicationType", null) b.HasOne("PARR.DAL.Models.V1_ApplicationType", null)
.WithMany("ApplicationTypes") .WithMany("ApplicationTypes")
.HasForeignKey("ApplicationTypeId"); .HasForeignKey("ApplicationTypeId");
}); });
@@ -490,7 +490,7 @@ namespace PARR.DAL.Migrations
b.Navigation("ApplicationsInHosts"); b.Navigation("ApplicationsInHosts");
}); });
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b => modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
{ {
b.Navigation("ApplicationTypes"); b.Navigation("ApplicationTypes");
}); });

View File

@@ -22,7 +22,7 @@ namespace PARR.DAL.Migrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("PARR.DAL.Models.Application", b => modelBuilder.Entity("PARR.DAL.Models.V1_Application", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -45,10 +45,10 @@ namespace PARR.DAL.Migrations
b.HasIndex("ApplicationTypeId"); b.HasIndex("ApplicationTypeId");
b.ToTable("Applications"); b.ToTable("V1_Application");
}); });
modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b => modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationInHost", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -72,18 +72,15 @@ namespace PARR.DAL.Migrations
b.HasIndex("HostId"); b.HasIndex("HostId");
b.ToTable("ApplicationsInHosts"); b.ToTable("V1_ApplicationInHost");
}); });
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b => modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<Guid?>("ApplicationTypeId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated") b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone"); .HasColumnType("timestamp with time zone");
@@ -97,11 +94,14 @@ namespace PARR.DAL.Migrations
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<Guid?>("V1_ApplicationTypeId")
.HasColumnType("uuid");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ApplicationTypeId"); b.HasIndex("V1_ApplicationTypeId");
b.ToTable("ApplicationTypes"); b.ToTable("V1_ApplicationType");
b.HasData( b.HasData(
new new
@@ -127,7 +127,7 @@ namespace PARR.DAL.Migrations
}); });
}); });
modelBuilder.Entity("PARR.DAL.Models.Host", b => modelBuilder.Entity("PARR.DAL.Models.V1_Host", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -163,10 +163,10 @@ namespace PARR.DAL.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("Hosts"); b.ToTable("V1_Host");
}); });
modelBuilder.Entity("PARR.DAL.Models.Job", b => modelBuilder.Entity("PARR.DAL.Models.V1_Job", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -217,10 +217,10 @@ namespace PARR.DAL.Migrations
b.HasIndex("JobTypeId"); b.HasIndex("JobTypeId");
b.ToTable("Jobs"); b.ToTable("V1_Job");
}); });
modelBuilder.Entity("PARR.DAL.Models.JobCategory", b => modelBuilder.Entity("PARR.DAL.Models.V1_JobCategory", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -241,10 +241,10 @@ namespace PARR.DAL.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("JobCategories"); b.ToTable("V1_JobCategory");
}); });
modelBuilder.Entity("PARR.DAL.Models.JobJournal", b => modelBuilder.Entity("PARR.DAL.Models.V1_JobJournal", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -285,10 +285,10 @@ namespace PARR.DAL.Migrations
b.HasIndex("JobStatusId"); b.HasIndex("JobStatusId");
b.ToTable("JobJournals"); b.ToTable("V1_JobJournal");
}); });
modelBuilder.Entity("PARR.DAL.Models.JobMode", b => modelBuilder.Entity("PARR.DAL.Models.V1_JobMode", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -306,7 +306,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("JobModes"); b.ToTable("V1_JobMode");
b.HasData( b.HasData(
new new
@@ -323,7 +323,7 @@ namespace PARR.DAL.Migrations
}); });
}); });
modelBuilder.Entity("PARR.DAL.Models.JobStatus", b => modelBuilder.Entity("PARR.DAL.Models.V1_JobStatus", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -344,7 +344,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("JobStatuses"); b.ToTable("V1_JobStatus");
b.HasData( b.HasData(
new new
@@ -363,7 +363,7 @@ namespace PARR.DAL.Migrations
}); });
}); });
modelBuilder.Entity("PARR.DAL.Models.JobType", b => modelBuilder.Entity("PARR.DAL.Models.V1_JobType", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -384,12 +384,12 @@ namespace PARR.DAL.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("JobTypes"); b.ToTable("V1_JobType");
}); });
modelBuilder.Entity("PARR.DAL.Models.Application", b => modelBuilder.Entity("PARR.DAL.Models.V1_Application", b =>
{ {
b.HasOne("PARR.DAL.Models.ApplicationType", "ApplicationType") b.HasOne("PARR.DAL.Models.V1_ApplicationType", "ApplicationType")
.WithMany() .WithMany()
.HasForeignKey("ApplicationTypeId") .HasForeignKey("ApplicationTypeId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
@@ -398,15 +398,15 @@ namespace PARR.DAL.Migrations
b.Navigation("ApplicationType"); b.Navigation("ApplicationType");
}); });
modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b => modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationInHost", b =>
{ {
b.HasOne("PARR.DAL.Models.Application", "Application") b.HasOne("PARR.DAL.Models.V1_Application", "Application")
.WithMany("ApplicationsInHosts") .WithMany("ApplicationsInHosts")
.HasForeignKey("ApplicationId") .HasForeignKey("ApplicationId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("PARR.DAL.Models.Host", "Host") b.HasOne("PARR.DAL.Models.V1_Host", "Host")
.WithMany("ApplicationsInHosts") .WithMany("ApplicationsInHosts")
.HasForeignKey("HostId") .HasForeignKey("HostId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
@@ -417,32 +417,32 @@ namespace PARR.DAL.Migrations
b.Navigation("Host"); b.Navigation("Host");
}); });
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b => modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
{ {
b.HasOne("PARR.DAL.Models.ApplicationType", null) b.HasOne("PARR.DAL.Models.V1_ApplicationType", null)
.WithMany("ApplicationTypes") .WithMany("ApplicationTypes")
.HasForeignKey("ApplicationTypeId"); .HasForeignKey("V1_ApplicationTypeId");
}); });
modelBuilder.Entity("PARR.DAL.Models.Job", b => modelBuilder.Entity("PARR.DAL.Models.V1_Job", b =>
{ {
b.HasOne("PARR.DAL.Models.Application", "Application") b.HasOne("PARR.DAL.Models.V1_Application", "Application")
.WithMany() .WithMany()
.HasForeignKey("ApplicationId") .HasForeignKey("ApplicationId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("PARR.DAL.Models.JobCategory", "JobCategorye") b.HasOne("PARR.DAL.Models.V1_JobCategory", "JobCategorye")
.WithMany("Jobs") .WithMany("Jobs")
.HasForeignKey("JobCategoryId"); .HasForeignKey("JobCategoryId");
b.HasOne("PARR.DAL.Models.JobMode", "JobMode") b.HasOne("PARR.DAL.Models.V1_JobMode", "JobMode")
.WithMany("Jobs") .WithMany("Jobs")
.HasForeignKey("JobModeId") .HasForeignKey("JobModeId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("PARR.DAL.Models.JobType", "JobType") b.HasOne("PARR.DAL.Models.V1_JobType", "JobType")
.WithMany("Jobs") .WithMany("Jobs")
.HasForeignKey("JobTypeId"); .HasForeignKey("JobTypeId");
@@ -455,21 +455,21 @@ namespace PARR.DAL.Migrations
b.Navigation("JobType"); b.Navigation("JobType");
}); });
modelBuilder.Entity("PARR.DAL.Models.JobJournal", b => modelBuilder.Entity("PARR.DAL.Models.V1_JobJournal", b =>
{ {
b.HasOne("PARR.DAL.Models.Host", "Host") b.HasOne("PARR.DAL.Models.V1_Host", "Host")
.WithMany("JobJournals") .WithMany("JobJournals")
.HasForeignKey("HostId") .HasForeignKey("HostId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("PARR.DAL.Models.Job", "Job") b.HasOne("PARR.DAL.Models.V1_Job", "Job")
.WithMany("Journals") .WithMany("Journals")
.HasForeignKey("JobId") .HasForeignKey("JobId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("PARR.DAL.Models.JobStatus", "Status") b.HasOne("PARR.DAL.Models.V1_JobStatus", "Status")
.WithMany("Journals") .WithMany("Journals")
.HasForeignKey("JobStatusId") .HasForeignKey("JobStatusId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
@@ -482,44 +482,44 @@ namespace PARR.DAL.Migrations
b.Navigation("Status"); b.Navigation("Status");
}); });
modelBuilder.Entity("PARR.DAL.Models.Application", b => modelBuilder.Entity("PARR.DAL.Models.V1_Application", b =>
{ {
b.Navigation("ApplicationsInHosts"); b.Navigation("ApplicationsInHosts");
}); });
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b => modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
{ {
b.Navigation("ApplicationTypes"); b.Navigation("ApplicationTypes");
}); });
modelBuilder.Entity("PARR.DAL.Models.Host", b => modelBuilder.Entity("PARR.DAL.Models.V1_Host", b =>
{ {
b.Navigation("ApplicationsInHosts"); b.Navigation("ApplicationsInHosts");
b.Navigation("JobJournals"); b.Navigation("JobJournals");
}); });
modelBuilder.Entity("PARR.DAL.Models.Job", b => modelBuilder.Entity("PARR.DAL.Models.V1_Job", b =>
{ {
b.Navigation("Journals"); b.Navigation("Journals");
}); });
modelBuilder.Entity("PARR.DAL.Models.JobCategory", b => modelBuilder.Entity("PARR.DAL.Models.V1_JobCategory", b =>
{ {
b.Navigation("Jobs"); b.Navigation("Jobs");
}); });
modelBuilder.Entity("PARR.DAL.Models.JobMode", b => modelBuilder.Entity("PARR.DAL.Models.V1_JobMode", b =>
{ {
b.Navigation("Jobs"); b.Navigation("Jobs");
}); });
modelBuilder.Entity("PARR.DAL.Models.JobStatus", b => modelBuilder.Entity("PARR.DAL.Models.V1_JobStatus", b =>
{ {
b.Navigation("Journals"); b.Navigation("Journals");
}); });
modelBuilder.Entity("PARR.DAL.Models.JobType", b => modelBuilder.Entity("PARR.DAL.Models.V1_JobType", b =>
{ {
b.Navigation("Jobs"); b.Navigation("Jobs");
}); });

View File

@@ -1,24 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("Applications")]
public class Application : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
public Guid ApplicationTypeId { get; set; }
[ForeignKey(nameof(ApplicationTypeId))]
public ApplicationType? ApplicationType { get; set; }
public ICollection<ApplicationInHost> ApplicationsInHosts { get; set; } = new HashSet<ApplicationInHost>();
//public ICollection<Application> Applications { get;set; } = new HashSet<Application>();
}
}

View File

@@ -1,23 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("ApplicationsInHosts")]
public class ApplicationInHost : IBase
{
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public Guid ApplicationId { get; set; }
[ForeignKey(nameof(ApplicationId))]
public Application? Application { get; set; }
public Guid HostId { get; set; }
[ForeignKey(nameof(HostId))]
public Host? Host { get; set; }
}
}

View File

@@ -1,18 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("ApplicationTypes")]
public class ApplicationType : IBase
{
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
public string? Description { get; set; }
public ICollection<ApplicationType> ApplicationTypes { get; set; } = new HashSet<ApplicationType>();
}
}

View File

@@ -1,27 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("Hosts")]
public class Host : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public string? HostName { get; set; }
public required string IP { get; set; }
public string? RegionalEK { get; set; }
public string? LinkEK { get; set; }
public string? Status { get; set; }
public string? WorkGroup { get; set; }
public string? Responsible { get; set; }
public ICollection<JobJournal> JobJournals { get; set; } = new HashSet<JobJournal>();
public ICollection<ApplicationInHost> ApplicationsInHosts { get; set; } = new HashSet<ApplicationInHost>();
}
}

View File

@@ -1,50 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("Jobs")]
public class Job : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
public required string ScriptName { get; set; }
public Guid JobModeId { get; set; }
[ForeignKey(nameof(JobModeId))]
public JobMode? JobMode { get; set; }
public Guid? JobCategoryId { get; set; }
[ForeignKey(nameof(JobCategoryId))]
public JobCategory? JobCategorye { get; set; }
public Guid? JobTypeId { get; set; }
[ForeignKey(nameof(JobTypeId))]
public JobType? JobType { get; set; }
public Guid ApplicationId { get; set; }
[ForeignKey(nameof(ApplicationId))]
public Application? Application { get; set; }
/// <summary>
/// Частота запуска Job в минутах
/// </summary>
public int Frequency { get; set; }
/// <summary>
/// В режиме manual значит время регистрации регламентной работы АСУ ЕСПП, в auto - время старта Job.
/// </summary>
public DateTimeOffset StartAt { get; set; }
/// <summary>
/// Активация Job
/// </summary>
public bool IsEnabled { get; set; }
public ICollection<JobJournal> Journals { get; set; } = new HashSet<JobJournal>();
}
}

View File

@@ -1,24 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("JobCategories")]
public class JobCategory : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
/// <summary>
/// app, db
/// </summary>
public required string Name { get; set; }
public string? Description { get; set; }
public ICollection<Job> Jobs { get; set; } = new HashSet<Job>();
}
}

View File

@@ -1,39 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("JobJournals")]
public class JobJournal : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public DateTimeOffset DateOper { get; set; }
public string? Other { get; set; }
//Возможно нужно перенести в Job
public int? TimeOut { get; set; }
//Возможно нужно перенести в Job
public string? Info { get; set; }
public Guid JobStatusId { get; set; }
[ForeignKey(nameof(JobStatusId))]
public JobStatus? Status { get; set; }
public Guid HostId { get; set; }
[ForeignKey(nameof(HostId))]
public Host? Host { get; set; }
public Guid JobId { get; set; }
[ForeignKey(nameof(JobId))]
public Job? Job { get; set; }
}
}

View File

@@ -1,23 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("JobModes")]
public class JobMode : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
/// <summary>
/// manual, auto
/// </summary>
public required string Name { get; set; }
public ICollection<Job> Jobs { get; set; } = new HashSet<Job>();
}
}

View File

@@ -1,24 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("JobStatuses")]
public class JobStatus : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
/// <summary>
/// started, finished, timeout, error
/// </summary>
public required string Name { get; set; }
public string? Description { get; set; }
public ICollection<JobJournal> Journals { get; set; } = new HashSet<JobJournal>();
}
}

View File

@@ -1,23 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("JobTypes")]
public class JobType : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
/// <summary>
/// log-rotate, vacuum-psqld
/// </summary>
public required string Name { get; set; }
public string? Description { get; set; }
public ICollection<Job> Jobs { get; set; } = new HashSet<Job>();
}
}

View File

@@ -1,19 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
//[Table("Schedulers")]
//public class Scheduler : IBase
//{
// //[Key]
// //public Guid Id { get; set; }
// //public DateTimeOffset DateCreated { get; set; }
// //public DateTimeOffset? DateModified { get; set; }
// //public string? Name { get; set; }
// //public int Frequency { get; set; }
// //public required DateTimeOffset StartAt { get; set; }
// //public bool IsEnabled { get; set; }
//}
}

View File

@@ -1,13 +1,13 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using PARR.DAL.Context; using PARR.DAL.Context;
using PARR.DAL.Models; using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts; using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces; using PARR.DAL.Services.Interfaces;
namespace PARR.DAL.Services.Implementations namespace PARR.DAL.Services.Implementations
{ {
internal class ApplicationInHostService : BaseService<ApplicationInHost>, IApplicationInHostService internal class ApplicationInHostService : BaseService<V1_ApplicationInHost>, IApplicationInHostService
{ {
private readonly DataContext dataContext; private readonly DataContext dataContext;
private readonly ILogger<ApplicationInHostService> logger; private readonly ILogger<ApplicationInHostService> logger;
@@ -18,7 +18,7 @@ namespace PARR.DAL.Services.Implementations
this.logger = logger; this.logger = logger;
} }
protected override DbSet<ApplicationInHost> EntitySet => dataContext.ApplicationsInHosts; protected override DbSet<V1_ApplicationInHost> EntitySet => dataContext.ApplicationsInHosts;
protected override DataContext EntitiContext => dataContext; protected override DataContext EntitiContext => dataContext;
} }

View File

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

View File

@@ -1,13 +1,13 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using PARR.DAL.Context; using PARR.DAL.Context;
using PARR.DAL.Models; using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts; using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces; using PARR.DAL.Services.Interfaces;
namespace PARR.DAL.Services.Implementations namespace PARR.DAL.Services.Implementations
{ {
internal class ApplicationTypeService : BaseService<ApplicationType>, IApplicationTypeService internal class ApplicationTypeService : BaseService<V1_ApplicationType>, IApplicationTypeService
{ {
private readonly DataContext dataContext; private readonly DataContext dataContext;
private readonly ILogger<ApplicationTypeService> logger; private readonly ILogger<ApplicationTypeService> logger;
@@ -18,7 +18,7 @@ namespace PARR.DAL.Services.Implementations
this.logger = logger; this.logger = logger;
} }
protected override DbSet<ApplicationType> EntitySet => dataContext.ApplicationTypes; protected override DbSet<V1_ApplicationType> EntitySet => dataContext.ApplicationTypes;
protected override DataContext EntitiContext => dataContext; protected override DataContext EntitiContext => dataContext;
} }

View File

@@ -1,18 +1,18 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using PARR.DAL.Context; using PARR.DAL.Context;
using PARR.DAL.Models; using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts; using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces; using PARR.DAL.Services.Interfaces;
namespace PARR.DAL.Services.Implementations namespace PARR.DAL.Services.Implementations
{ {
internal class HostService : BaseService<Host>, IHostService internal class HostService : BaseService<V1_Host>, IHostService
{ {
private readonly DataContext dataContext; private readonly DataContext dataContext;
private readonly ILogger<HostService> logger; private readonly ILogger<HostService> logger;
protected override DbSet<Host> EntitySet => dataContext.Hosts; protected override DbSet<V1_Host> EntitySet => dataContext.Hosts;
protected override DataContext EntitiContext => dataContext; protected override DataContext EntitiContext => dataContext;
public HostService(DataContext dataContext, ILogger<HostService> logger) : base(logger) public HostService(DataContext dataContext, ILogger<HostService> logger) : base(logger)
@@ -21,7 +21,7 @@ namespace PARR.DAL.Services.Implementations
this.logger = logger; this.logger = logger;
} }
public async Task<Host?> GetHostWithAppsAsync(string IP, string RegionalEK) public async Task<V1_Host?> GetHostWithAppsAsync(string IP, string RegionalEK)
{ {
//try //try
@@ -40,7 +40,7 @@ namespace PARR.DAL.Services.Implementations
.FirstOrDefaultAsync(h => h.IP == IP && h.RegionalEK == RegionalEK); .FirstOrDefaultAsync(h => h.IP == IP && h.RegionalEK == RegionalEK);
} }
public async Task<Host?> GetHostWithAppsAsync(string IP, string linkEK, string regionalEK) public async Task<V1_Host?> GetHostWithAppsAsync(string IP, string linkEK, string regionalEK)
{ {
return await EntitySet 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)
@@ -49,7 +49,7 @@ namespace PARR.DAL.Services.Implementations
} }
public async Task<Host?> GetHostByIPAndRegionalEKAsync(string IP, string RegionalEK) public async Task<V1_Host?> GetHostByIPAndRegionalEKAsync(string IP, string RegionalEK)
{ {
return await EntitySet.FirstOrDefaultAsync(h => h.IP == IP && h.RegionalEK == RegionalEK); return await EntitySet.FirstOrDefaultAsync(h => h.IP == IP && h.RegionalEK == RegionalEK);
} }

View File

@@ -7,7 +7,7 @@ using PARR.DAL.Services.Interfaces;
namespace PARR.DAL.Services.Implementations namespace PARR.DAL.Services.Implementations
{ {
internal class JobCategoryService : BaseService<JobCategory>, IJobCategoryService internal class JobCategoryService : BaseService<V1_JobCategory>, IJobCategoryService
{ {
private readonly DataContext dataContext; private readonly DataContext dataContext;
private readonly ILogger<JobCategoryService> logger; private readonly ILogger<JobCategoryService> logger;
@@ -17,7 +17,7 @@ namespace PARR.DAL.Services.Implementations
this.dataContext = dataContext; this.dataContext = dataContext;
this.logger = logger; this.logger = logger;
} }
protected override DbSet<JobCategory> EntitySet => dataContext.JobCategories; protected override DbSet<V1_JobCategory> EntitySet => dataContext.JobCategories;
protected override DataContext EntitiContext => dataContext; protected override DataContext EntitiContext => dataContext;
} }

View File

@@ -2,13 +2,13 @@
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using PARR.DAL.Context; using PARR.DAL.Context;
using PARR.DAL.Extensions; using PARR.DAL.Extensions;
using PARR.DAL.Models; using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts; using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces; using PARR.DAL.Services.Interfaces;
namespace PARR.DAL.Services.Implementations namespace PARR.DAL.Services.Implementations
{ {
internal class JobJournalService : BaseService<JobJournal>, IJobJournalService internal class JobJournalService : BaseService<V1_JobJournal>, IJobJournalService
{ {
private readonly DataContext dataContext; private readonly DataContext dataContext;
private readonly ILogger<JobJournalService> logger; private readonly ILogger<JobJournalService> logger;
@@ -18,11 +18,11 @@ namespace PARR.DAL.Services.Implementations
this.dataContext = dataContext; this.dataContext = dataContext;
this.logger = logger; this.logger = logger;
} }
protected override DbSet<JobJournal> EntitySet => dataContext.JobJournals; protected override DbSet<V1_JobJournal> EntitySet => dataContext.JobJournals;
protected override DataContext EntitiContext => dataContext; protected override DataContext EntitiContext => dataContext;
public async Task<JobJournal?> GetLastAsync(Guid jobId, Guid hostId, DateTimeOffset date) public async Task<V1_JobJournal?> GetLastAsync(Guid jobId, Guid hostId, DateTimeOffset date)
{ {
//var n=DateTimeOffset.UtcNow; //var n=DateTimeOffset.UtcNow;
//var opers = await EntitySet //var opers = await EntitySet

View File

@@ -1,13 +1,13 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using PARR.DAL.Context; using PARR.DAL.Context;
using PARR.DAL.Models; using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts; using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces; using PARR.DAL.Services.Interfaces;
namespace PARR.DAL.Services.Implementations namespace PARR.DAL.Services.Implementations
{ {
internal class JobModeService : BaseService<JobMode>, IJobModeService internal class JobModeService : BaseService<V1_JobMode>, IJobModeService
{ {
private readonly DataContext dataContext; private readonly DataContext dataContext;
private readonly ILogger<JobModeService> logger; private readonly ILogger<JobModeService> logger;
@@ -17,7 +17,7 @@ namespace PARR.DAL.Services.Implementations
this.dataContext = dataContext; this.dataContext = dataContext;
this.logger = logger; this.logger = logger;
} }
protected override DbSet<JobMode> EntitySet => dataContext.JobModes; protected override DbSet<V1_JobMode> EntitySet => dataContext.JobModes;
protected override DataContext EntitiContext => dataContext; protected override DataContext EntitiContext => dataContext;
} }

View File

@@ -1,7 +1,7 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using PARR.DAL.Context; using PARR.DAL.Context;
using PARR.DAL.Models; using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts; using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces; using PARR.DAL.Services.Interfaces;
using System; using System;
@@ -12,7 +12,7 @@ using System.Threading.Tasks;
namespace PARR.DAL.Services.Implementations namespace PARR.DAL.Services.Implementations
{ {
internal class JobService : BaseService<Job>, IJobService internal class JobService : BaseService<V1_Job>, IJobService
{ {
private readonly DataContext dataContext; private readonly DataContext dataContext;
private readonly ILogger<JobService> logger; private readonly ILogger<JobService> logger;
@@ -22,7 +22,7 @@ namespace PARR.DAL.Services.Implementations
this.dataContext = dataContext; this.dataContext = dataContext;
this.logger = logger; this.logger = logger;
} }
protected override DbSet<Job> EntitySet => dataContext.Jobs; protected override DbSet<V1_Job> EntitySet => dataContext.Jobs;
protected override DataContext EntitiContext => dataContext; protected override DataContext EntitiContext => dataContext;

View File

@@ -1,13 +1,13 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using PARR.DAL.Context; using PARR.DAL.Context;
using PARR.DAL.Models; using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts; using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces; using PARR.DAL.Services.Interfaces;
namespace PARR.DAL.Services.Implementations namespace PARR.DAL.Services.Implementations
{ {
internal class JobStatusService : BaseService<JobStatus>, IJobStatusService internal class JobStatusService : BaseService<V1_JobStatus>, IJobStatusService
{ {
private readonly DataContext dataContext; private readonly DataContext dataContext;
private readonly ILogger<JobStatusService> logger; private readonly ILogger<JobStatusService> logger;
@@ -17,7 +17,7 @@ namespace PARR.DAL.Services.Implementations
this.dataContext = dataContext; this.dataContext = dataContext;
this.logger = logger; this.logger = logger;
} }
protected override DbSet<JobStatus> EntitySet => dataContext.JobStatuses; protected override DbSet<V1_JobStatus> EntitySet => dataContext.JobStatuses;
protected override DataContext EntitiContext => dataContext; protected override DataContext EntitiContext => dataContext;
} }

View File

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

View File

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

View File

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

View File

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

View File

@@ -3,7 +3,7 @@ using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces namespace PARR.DAL.Services.Interfaces
{ {
internal interface IJobCategoryService : IBaseService<JobCategory> internal interface IJobCategoryService : IBaseService<V1_JobCategory>
{ {
} }
} }

View File

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

View File

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

View File

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

View File

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