From 3d89e5956ca0991c10d83d06f448ffae8ebb3c51 Mon Sep 17 00:00:00 2001 From: Mikhail Kuznetsov Date: Thu, 18 Apr 2024 10:18:14 +1000 Subject: [PATCH] =?UTF-8?q?feat(dal,aihitLoader,aihitSyncer):=20=D0=B4?= =?UTF-8?q?=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B=20=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=D1=8B=D0=B5=20=D1=82=D0=B8=D0=BF=D1=8B=20=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D0=B3=D1=80=D0=B0=D0=BC=D0=BC=D0=BD=D0=BE=D0=B3=D0=BE=20?= =?UTF-8?q?=D0=BE=D0=B1=D0=B5=D1=81=D0=BF=D0=B5=D1=87=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F.=20=D0=9F=D1=80=D0=B8=20=D1=81=D0=B8=D0=BD=D1=85=D1=80?= =?UTF-8?q?=D0=BE=D0=BD=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D0=B8=20=D1=85=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D1=8B=20=D0=BD=D0=B0=D1=85=D0=BE=D0=B4=D1=8F=D1=82?= =?UTF-8?q?=D1=81=D1=8F=20=D0=BF=D0=BE=20=D0=B8=D0=BC=D0=B5=D0=BD=D0=B8=20?= =?UTF-8?q?=D0=AD=D0=9A=20=D0=B2=D0=BC=D0=B5=D1=81=D1=82=D0=BE=20IP-=D0=B0?= =?UTF-8?q?=D0=B4=D0=B5=D1=80=D1=81=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PARR.AIHITLoader/AihitLoader.cs | 17 +- PARR.AIHITSyncer/AihitSyncer.cs | 4 +- PARR.AIHITSyncer/Services/SyncerService.cs | 58 +- PARR.BLL/Domain/Mq/AihitDataMq.cs | 10 +- PARR.DAL/Context/DataContext.cs | 10 +- PARR.DAL/Contracts/ApplicationTypesEnum.cs | 6 +- ...27_TblApplicationTypeAddValues.Designer.cs | 2644 +++++++++++++++++ ...40417231927_TblApplicationTypeAddValues.cs | 94 + .../Migrations/DataContextModelSnapshot.cs | 34 +- .../Services/Implementations/HostService.cs | 79 +- PARR.DAL/Services/Interfaces/IHostService.cs | 6 +- 11 files changed, 2877 insertions(+), 85 deletions(-) create mode 100644 PARR.DAL/Migrations/20240417231927_TblApplicationTypeAddValues.Designer.cs create mode 100644 PARR.DAL/Migrations/20240417231927_TblApplicationTypeAddValues.cs diff --git a/PARR.AIHITLoader/AihitLoader.cs b/PARR.AIHITLoader/AihitLoader.cs index a237579f..e4565b15 100644 --- a/PARR.AIHITLoader/AihitLoader.cs +++ b/PARR.AIHITLoader/AihitLoader.cs @@ -71,7 +71,7 @@ namespace PARR.AIHITLoader logger.LogDebug($"Список ЭК переданных в RabbitMQ: {string.Join(", ", batch)}"); } else - logger.LogError($"Ошибка при передаче нарядов в Rabbit, не переданные сообщения: {string.Join(", ", sendResult.NotSendMessages)}"); + logger.LogError($"Ошибка при передаче нарядов в Rabbit, не переданные сообщения: {string.Join(", ", sendResult.NotSendMessages!)}"); } } @@ -86,7 +86,8 @@ namespace PARR.AIHITLoader private List FilterData(List aihitData) { var vrt = aihitData.Where(ek => ek.EKFindCode!.StartsWith("ВРТ", true, CultureInfo.GetCultureInfo("ru-RU"))).ToList(); - return vrt.Where(vrt => vrt.IP != null).ToList(); + //return vrt.Where(vrt => vrt.IP != null).ToList(); + return vrt.ToList(); } private List? GetDataFromAihit(string respArea) @@ -108,11 +109,15 @@ namespace PARR.AIHITLoader { EK = ek.EKFindCode!, IP = ek.IP, - APPType = ek.APPType, - DBType = ek.DBType, - OSType = ek.OSType, + APP = ek.APPType, + DB = ek.DBType, + CKBS = ek.CKBSServerType, + IB = ek.IBServerType, + SI = ek.InfrastructureServerType, + SM = ek.MonitoringServerType, + OS = ek.OSType, WorkGroup = ek.WorkGroup, - Status = (ek.Status == "00-ГВЦ")? "99-ГВЦ": ek.Status!, + Status = (ek.Status == "00-ГВЦ") ? "99-ГВЦ" : ek.Status!, ResponseArea = ek.ResponseArea! }; } diff --git a/PARR.AIHITSyncer/AihitSyncer.cs b/PARR.AIHITSyncer/AihitSyncer.cs index 77ee9fcc..9aeb2301 100644 --- a/PARR.AIHITSyncer/AihitSyncer.cs +++ b/PARR.AIHITSyncer/AihitSyncer.cs @@ -92,7 +92,7 @@ namespace PARR.AIHITSyncer //private async Task SyncHostToScopeAsync(IHostService hostService, AihitDataMq objFromQuery) //{ // //ищем существующий хост в БД - // var host = await hostService.GetHostWithAppsAsync(objFromQuery.IP); + // var host = await hostService.GetHostWithAppsByIpAsync(objFromQuery.IP); // var isNew = false; // //если не нашли - создаём // if (host == null) @@ -136,7 +136,7 @@ namespace PARR.AIHITSyncer // logger.LogInformation($"----- Создан узел: {host.Id} -----"); - // return await hostService.GetHostWithAppsAsync(host.IP); + // return await hostService.GetHostWithAppsByIpAsync(host.IP); //} diff --git a/PARR.AIHITSyncer/Services/SyncerService.cs b/PARR.AIHITSyncer/Services/SyncerService.cs index 09439878..751f91ac 100644 --- a/PARR.AIHITSyncer/Services/SyncerService.cs +++ b/PARR.AIHITSyncer/Services/SyncerService.cs @@ -54,7 +54,8 @@ namespace PARR.AIHITSyncer.Services private async Task SyncHostAsync(AihitDataMq objFromQuery) { //ищем существующий хост в БД - var host = await hostService.GetHostWithAppsAsync(objFromQuery.IP); + //var host = await hostService.GetHostWithAppsByIpAsync(objFromQuery.IP); + var host = await hostService.GetHostWithAppsByEkAsync(objFromQuery.EK); var isNew = false; //если не нашли - создаём if (host == null) @@ -95,7 +96,8 @@ namespace PARR.AIHITSyncer.Services logger.LogInformation($"----- Создан узел: {host.Id} -----"); - return await hostService.GetHostWithAppsAsync(host.IP); + //return await hostService.GetHostWithAppsByIpAsync(host.IP); + return await hostService.GetHostWithAppsByEkAsync(host.Ek); } @@ -137,9 +139,9 @@ namespace PARR.AIHITSyncer.Services { var applications = new List(); - if (objFromQuery.APPType != null) + if (objFromQuery.APP != null) { - var appList = objFromQuery.APPType.Split(new char[] { ',', ';' }).Distinct().ToList(); + var appList = objFromQuery.APP.Split(new char[] { ',', ';' }).Distinct().ToList(); foreach (var app in appList) { var created = await CreateAppIfNotExistAsync(app, ApplicationTypesEnum.APP); @@ -147,9 +149,9 @@ namespace PARR.AIHITSyncer.Services applications.Add(created); } } - if (objFromQuery.DBType != null) + if (objFromQuery.DB != null) { - var appList = objFromQuery.DBType.Split(new char[] { ',', ';' }).Distinct().ToList(); + var appList = objFromQuery.DB.Split(new char[] { ',', ';' }).Distinct().ToList(); foreach (var app in appList) { var created = await CreateAppIfNotExistAsync(app, ApplicationTypesEnum.DB); @@ -157,9 +159,49 @@ namespace PARR.AIHITSyncer.Services applications.Add(created); } } - if (objFromQuery.OSType != null) + if (objFromQuery.CKBS != null) { - var appList = objFromQuery.OSType.Split(new char[] { ',', ';' }).Distinct().ToList(); + var appList = objFromQuery.CKBS.Split(new char[] { ',', ';' }).Distinct().ToList(); + foreach (var app in appList) + { + var created = await CreateAppIfNotExistAsync(app, ApplicationTypesEnum.CKBS); + if (created != null) + applications.Add(created); + } + } + if (objFromQuery.IB != null) + { + var appList = objFromQuery.IB.Split(new char[] { ',', ';' }).Distinct().ToList(); + foreach (var app in appList) + { + var created = await CreateAppIfNotExistAsync(app, ApplicationTypesEnum.IB); + if (created != null) + applications.Add(created); + } + } + if (objFromQuery.SI != null) + { + var appList = objFromQuery.SI.Split(new char[] { ',', ';' }).Distinct().ToList(); + foreach (var app in appList) + { + var created = await CreateAppIfNotExistAsync(app, ApplicationTypesEnum.SI); + if (created != null) + applications.Add(created); + } + } + if (objFromQuery.SM != null) + { + var appList = objFromQuery.SM.Split(new char[] { ',', ';' }).Distinct().ToList(); + foreach (var app in appList) + { + var created = await CreateAppIfNotExistAsync(app, ApplicationTypesEnum.SM); + if (created != null) + applications.Add(created); + } + } + if (objFromQuery.OS != null) + { + var appList = objFromQuery.OS.Split(new char[] { ',', ';' }).Distinct().ToList(); foreach (var app in appList) { var created = await CreateAppIfNotExistAsync(app, ApplicationTypesEnum.OS); diff --git a/PARR.BLL/Domain/Mq/AihitDataMq.cs b/PARR.BLL/Domain/Mq/AihitDataMq.cs index b8db206e..5285318c 100644 --- a/PARR.BLL/Domain/Mq/AihitDataMq.cs +++ b/PARR.BLL/Domain/Mq/AihitDataMq.cs @@ -7,9 +7,13 @@ { public required string EK { get; set; } public string? IP { get; set; } - public string? DBType { get; set; } - public string? APPType { get; set; } - public string? OSType { get; set; } + public string? DB { get; set; } + public string? APP { get; set; } + public string? CKBS { get; set; } + public string? IB { get; set; } + public string? SI { get; set; } + public string? SM { get; set; } + public string? OS { get; set; } public string? WorkGroup { get; set; } public required string Status { get; set; } public required string ResponseArea { get; set; } diff --git a/PARR.DAL/Context/DataContext.cs b/PARR.DAL/Context/DataContext.cs index 3a35a1e7..f28a8818 100644 --- a/PARR.DAL/Context/DataContext.cs +++ b/PARR.DAL/Context/DataContext.cs @@ -62,9 +62,13 @@ namespace PARR.DAL.Context modelBuilder.Entity(f => { 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("7848a96c-cdee-48c1-a786-de9cb889723a"), DateCreated = dateCreated, DateModified = null, Name = ApplicationTypesEnum.OS.ToString(), Description = "Поле ОС xml АИХ ИТ" }, - new() { Id = new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"), DateCreated = dateCreated, DateModified = null, Name = ApplicationTypesEnum.DB.ToString(), Description = "Поле СУБД xml АИХ ИТ" } + new() { Id = new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"), DateCreated = dateCreated, DateModified = null, Name = ApplicationTypesEnum.APP.ToString(), Description = "Сервер приложений" }, + new() { Id = new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"), DateCreated = dateCreated, DateModified = null, Name = ApplicationTypesEnum.OS.ToString(), Description = "ОС" }, + new() { Id = new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"), DateCreated = dateCreated, DateModified = null, Name = ApplicationTypesEnum.DB.ToString(), Description = "СУБД" }, + new() { Id = new Guid("749f4c34-b883-4f28-90dd-c161dd3c4270"), DateCreated = dateCreated, DateModified = null, Name = ApplicationTypesEnum.CKBS.ToString(), Description = "ЦК БС" }, + new() { Id = new Guid("0bd96f9b-d36b-4dfb-bd8a-9c356bc6912b"), DateCreated = dateCreated, DateModified = null, Name = ApplicationTypesEnum.IB.ToString(), Description = "ИБ" }, + new() { Id = new Guid("4466148b-510d-4423-a58f-ce878152ff01"), DateCreated = dateCreated, DateModified = null, Name = ApplicationTypesEnum.SI.ToString(), Description = "Инфраструктура" }, + new() { Id = new Guid("725a96db-358e-489b-a7c9-a84b06ec15df"), DateCreated = dateCreated, DateModified = null, Name = ApplicationTypesEnum.SM.ToString(), Description = "Мониторинг" } ); }); #endregion diff --git a/PARR.DAL/Contracts/ApplicationTypesEnum.cs b/PARR.DAL/Contracts/ApplicationTypesEnum.cs index 1e2ef089..6fcbc0c4 100644 --- a/PARR.DAL/Contracts/ApplicationTypesEnum.cs +++ b/PARR.DAL/Contracts/ApplicationTypesEnum.cs @@ -4,6 +4,10 @@ { APP, OS, - DB + DB, + CKBS, + IB, + SI, + SM } } diff --git a/PARR.DAL/Migrations/20240417231927_TblApplicationTypeAddValues.Designer.cs b/PARR.DAL/Migrations/20240417231927_TblApplicationTypeAddValues.Designer.cs new file mode 100644 index 00000000..9664d9ea --- /dev/null +++ b/PARR.DAL/Migrations/20240417231927_TblApplicationTypeAddValues.Designer.cs @@ -0,0 +1,2644 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using PARR.DAL.Context; + +#nullable disable + +namespace PARR.DAL.Migrations +{ + [DbContext(typeof(DataContext))] + [Migration("20240417231927_TblApplicationTypeAddValues")] + partial class TblApplicationTypeAddValues + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.5") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("PARR.DAL.Models.AgentHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("HistoryLevelId") + .HasColumnType("integer"); + + b.Property("Message") + .HasColumnType("text"); + + b.Property("OrderId") + .HasColumnType("uuid"); + + b.Property("TemplateId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("HistoryLevelId"); + + b.HasIndex("OrderId"); + + b.HasIndex("TemplateId"); + + b.ToTable("AgentHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.AgentHistoryLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("AgentHistoryLevels"); + + b.HasData( + new + { + Id = 1, + Description = "Агент начал выполнять задание", + Name = "Start" + }, + new + { + Id = 5, + Description = "Агент завершил выполнение задания", + Name = "End" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Application", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationTypeId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationTypeId"); + + b.HasIndex("Name", "ApplicationTypeId") + .IsUnique(); + + b.ToTable("Applications"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("HostId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationId"); + + b.HasIndex("HostId"); + + b.ToTable("ApplicationsInHost"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("ApplicationTypes"); + + b.HasData( + new + { + Id = new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Сервер приложений", + Name = "APP" + }, + new + { + Id = new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "ОС", + Name = "OS" + }, + new + { + Id = new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "СУБД", + Name = "DB" + }, + new + { + Id = new Guid("749f4c34-b883-4f28-90dd-c161dd3c4270"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "ЦК БС", + Name = "CKBS" + }, + new + { + Id = new Guid("0bd96f9b-d36b-4dfb-bd8a-9c356bc6912b"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "ИБ", + Name = "IB" + }, + new + { + Id = new Guid("4466148b-510d-4423-a58f-ce878152ff01"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Инфраструктура", + Name = "SI" + }, + new + { + Id = new Guid("725a96db-358e-489b-a7c9-a84b06ec15df"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Мониторинг", + Name = "SM" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationsInWork", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AgentName") + .HasColumnType("text"); + + b.Property("AgentScript") + .HasColumnType("text"); + + b.Property("AgentTimeOutSec") + .HasColumnType("integer"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("FullDescription") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsAgent") + .HasColumnType("boolean"); + + b.Property("LastRun") + .HasColumnType("timestamp with time zone"); + + b.Property("NextRun") + .HasColumnType("timestamp with time zone"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("text"); + + b.Property("Solution") + .IsRequired() + .HasColumnType("text"); + + b.Property("TemplateDuration") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationId"); + + b.HasIndex("WorkId", "ApplicationId") + .IsUnique(); + + b.ToTable("ApplicationsInWorks"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EkStatus", b => + { + b.Property("Code") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Code")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Code"); + + b.ToTable("EkStatuses"); + + b.HasData( + new + { + Code = 1, + Name = "1-Новый" + }, + new + { + Code = 2, + Name = "2-Подготовка к эксплуатации" + }, + new + { + Code = 3, + Name = "3-В эксплуатации" + }, + new + { + Code = 4, + Name = "4-В ремонте" + }, + new + { + Code = 5, + Name = "5-В резерве" + }, + new + { + Code = 6, + Name = "6-Выведен из эксплуатации" + }, + new + { + Code = 7, + Name = "7-Тестовый" + }, + new + { + Code = 9, + Name = "9-В разработке" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("EsppSchTypes"); + + b.HasData( + new + { + Id = 1, + Description = "Через интервал", + Name = "Interval" + }, + new + { + Id = 2, + Description = "День недели: пнд, вт...", + Name = "DayOfWeek" + }, + new + { + Id = 3, + Description = "Число месяца: 1,2,3,4", + Name = "DayOfMonth" + }, + new + { + Id = 4, + Description = "Каждый: первый, второй, третий, четвертый, последний", + Name = "Order" + }, + new + { + Id = 5, + Description = "Месяц: январь, февраль...", + Name = "Month" + }, + new + { + Id = 6, + Description = "Месяц (родительный падеж): января, февраля...", + Name = "MonthGenitive" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeConfig", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("TypeId") + .HasColumnType("integer"); + + b.Property("TypeScheduleId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("TypeId"); + + b.HasIndex("TypeScheduleId", "TypeId") + .IsUnique(); + + b.ToTable("EsppSchTypeConfigs"); + + b.HasData( + new + { + Id = new Guid("d2693562-b3eb-41e9-97db-c6b5d2ef1bea"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 0, + TypeId = 1, + TypeScheduleId = 1 + }, + new + { + Id = new Guid("06b2e7aa-6927-4fbf-99fb-67c92a4fce8a"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 0, + TypeId = 2, + TypeScheduleId = 2 + }, + new + { + Id = new Guid("78079071-ff80-417e-9bb0-d928cec853e7"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 0, + TypeId = 3, + TypeScheduleId = 3 + }, + new + { + Id = new Guid("accb1d46-e1c1-4396-9182-4c0766155921"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 0, + TypeId = 4, + TypeScheduleId = 4 + }, + new + { + Id = new Guid("162ffe73-2428-4abe-8f83-235c2593664c"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 1, + TypeId = 2, + TypeScheduleId = 4 + }, + new + { + Id = new Guid("8470d1ef-165d-42fc-ab05-8203e4d263cf"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 0, + TypeId = 5, + TypeScheduleId = 5 + }, + new + { + Id = new Guid("006900b5-f65c-413e-bc67-09e6dae60b7c"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 1, + TypeId = 3, + TypeScheduleId = 5 + }, + new + { + Id = new Guid("85635bc8-f17a-46b8-9c15-8615761be3d9"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 0, + TypeId = 4, + TypeScheduleId = 6 + }, + new + { + Id = new Guid("439460c2-deca-4b54-80e7-2f20806696ec"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 1, + TypeId = 2, + TypeScheduleId = 6 + }, + new + { + Id = new Guid("5c63ad8c-e9b4-43fd-9d24-5c2eed80dadd"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 2, + TypeId = 6, + TypeScheduleId = 6 + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeSchedule", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("EsppSchTypeSchedules"); + + b.HasData( + new + { + Id = 1, + Description = "Регулярно", + Name = "Regularly" + }, + new + { + Id = 2, + Description = "Еженедельно", + Name = "Weekly" + }, + new + { + Id = 3, + Description = "Ежемесячно", + Name = "Monthly" + }, + new + { + Id = 4, + Description = "Ежемесячно-2", + Name = "Monthly2" + }, + new + { + Id = 5, + Description = "Ежегодно", + Name = "Annually" + }, + new + { + Id = 6, + Description = "Ежегодно-2", + Name = "Annually2" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("EsppExportValue") + .IsRequired() + .HasColumnType("text"); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("TypeId") + .HasColumnType("integer"); + + b.Property("Value") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("TypeId"); + + b.ToTable("EsppSchTypeValues"); + + b.HasData( + new + { + Id = new Guid("6e3b5dd2-b2f7-40bc-bace-15bfa6bbd4ff"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "01:00:00", + Order = 0, + TypeId = 1, + Value = "Каждый час" + }, + new + { + Id = new Guid("4df04834-f14f-43d9-8984-334f080f4107"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "02:00:00", + Order = 1, + TypeId = 1, + Value = "Каждые 2 часа" + }, + new + { + Id = new Guid("dab6e3f9-2385-4966-b77c-133ad233c592"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "03:00:00", + Order = 2, + TypeId = 1, + Value = "Каждые 3 часа" + }, + new + { + Id = new Guid("035f485d-8451-47df-bfaa-ba4dd36cf146"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "04:00:00", + Order = 3, + TypeId = 1, + Value = "Каждые 4 часа" + }, + new + { + Id = new Guid("d627daa7-3eed-4571-acae-ffbb3c5bedb9"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "06:00:00", + Order = 4, + TypeId = 1, + Value = "Каждые 6 часов" + }, + new + { + Id = new Guid("ae0a0015-0f1e-4496-b71e-6244f7e321e7"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "12:00:00", + Order = 5, + TypeId = 1, + Value = "Каждые 12 часов" + }, + new + { + Id = new Guid("8df097aa-9860-4a62-9675-a8eecd3f2ce7"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "1 00:00:00", + Order = 6, + TypeId = 1, + Value = "Ежедневно" + }, + new + { + Id = new Guid("dee32e60-c1a1-4206-98bc-aa03deabfdf6"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "3 00:00:00", + Order = 7, + TypeId = 1, + Value = "Каждые 72 часа" + }, + new + { + Id = new Guid("e0465fbf-e3a5-4486-9f53-5bb85c6feeca"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "4 00:00:00", + Order = 8, + TypeId = 1, + Value = "Каждые 96 часов" + }, + new + { + Id = new Guid("4e3f73d1-a0f3-4dd1-bca9-68ada0dd5ce2"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "14 00:00:00", + Order = 9, + TypeId = 1, + Value = "Каждые 2 недели" + }, + new + { + Id = new Guid("55833417-6a24-42f6-bcc2-5d032f883202"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "60 00:00:00", + Order = 10, + TypeId = 1, + Value = "Каждые 60 дней" + }, + new + { + Id = new Guid("7fefa052-29db-4ce5-9c57-2fd9ff855f21"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "80 00:00:00", + Order = 11, + TypeId = 1, + Value = "Каждые 80 дней" + }, + new + { + Id = new Guid("b0ca99f9-5ee0-45b3-bb80-948f82b1fcb1"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "90 00:00:00", + Order = 12, + TypeId = 1, + Value = "Каждые 90 дней" + }, + new + { + Id = new Guid("086f7a37-9848-423a-a3cc-36dbb5ad43e3"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "182 00:00:00", + Order = 13, + TypeId = 1, + Value = "Каждые полгода" + }, + new + { + Id = new Guid("f2da9e02-d619-4517-a598-374880a8c8e8"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "540 00:00:00", + Order = 14, + TypeId = 1, + Value = "Каждые 1,5 года" + }, + new + { + Id = new Guid("f38d7d30-8923-4ea0-aa7c-5b251e19ab61"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "1095 00:00:00", + Order = 15, + TypeId = 1, + Value = "Каждые 3 года" + }, + new + { + Id = new Guid("b7303461-9a30-43fa-8e55-305aa13f186f"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "1", + Order = 0, + TypeId = 2, + Value = "Понедельник" + }, + new + { + Id = new Guid("e951135e-71f2-4262-9342-df4d5315ab6c"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "2", + Order = 1, + TypeId = 2, + Value = "Вторник" + }, + new + { + Id = new Guid("c34d5375-70e7-4632-b3af-30e279a0621a"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "3", + Order = 2, + TypeId = 2, + Value = "Среда" + }, + new + { + Id = new Guid("ec9540df-c2de-4bda-a063-34d02d4b6e03"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "4", + Order = 3, + TypeId = 2, + Value = "Четверг" + }, + new + { + Id = new Guid("2ed85534-4684-4eb2-9ccb-e264d212c945"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "5", + Order = 4, + TypeId = 2, + Value = "Пятница" + }, + new + { + Id = new Guid("a6804315-96ef-484e-82ee-c5795694468b"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "6", + Order = 5, + TypeId = 2, + Value = "Суббота" + }, + new + { + Id = new Guid("eb71e699-937f-4894-9688-f7a7f95e5e58"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "7", + Order = 6, + TypeId = 2, + Value = "Воскресенье" + }, + new + { + Id = new Guid("e86adbfb-3345-4e0c-aa3b-b4418f9cfe88"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "1", + Order = 0, + TypeId = 3, + Value = "1" + }, + new + { + Id = new Guid("5b4d7ca6-31e7-475b-b7c8-13c6680c3dc3"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "2", + Order = 1, + TypeId = 3, + Value = "2" + }, + new + { + Id = new Guid("0da03db0-9404-425d-bea1-5da0c9b60b59"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "3", + Order = 2, + TypeId = 3, + Value = "3" + }, + new + { + Id = new Guid("199474c8-0a77-47e5-aab8-ba33c216cc9e"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "4", + Order = 3, + TypeId = 3, + Value = "4" + }, + new + { + Id = new Guid("e6619da1-f7e8-45b9-bbd3-9c17bec2ccd3"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "5", + Order = 4, + TypeId = 3, + Value = "5" + }, + new + { + Id = new Guid("a8708763-c838-49a5-95fe-bf4f73518d71"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "6", + Order = 5, + TypeId = 3, + Value = "6" + }, + new + { + Id = new Guid("7ec056aa-820c-4900-96cb-4564d2ea6398"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "7", + Order = 6, + TypeId = 3, + Value = "7" + }, + new + { + Id = new Guid("554d7d0c-91b1-4b81-b94d-1ee864192962"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "8", + Order = 7, + TypeId = 3, + Value = "8" + }, + new + { + Id = new Guid("8b7847a4-23de-4199-8aad-3b5c0323b5a2"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "9", + Order = 8, + TypeId = 3, + Value = "9" + }, + new + { + Id = new Guid("fb7f41ca-950b-4dc1-a0a6-bd9a221ab2ad"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "10", + Order = 9, + TypeId = 3, + Value = "10" + }, + new + { + Id = new Guid("a28b530f-ea38-4a2c-a16b-0b7fa3770d3c"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "11", + Order = 10, + TypeId = 3, + Value = "11" + }, + new + { + Id = new Guid("7a004a11-32e1-40ae-ab35-0d3dc3a69785"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "12", + Order = 11, + TypeId = 3, + Value = "12" + }, + new + { + Id = new Guid("e0f2f4d1-4a5e-4997-8336-83c3c35f38df"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "13", + Order = 12, + TypeId = 3, + Value = "13" + }, + new + { + Id = new Guid("9c5aaf48-88ec-4c67-b936-2be45550f8bf"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "14", + Order = 13, + TypeId = 3, + Value = "14" + }, + new + { + Id = new Guid("8dbd680c-ce49-4d2e-8a1a-05619685e240"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "15", + Order = 14, + TypeId = 3, + Value = "15" + }, + new + { + Id = new Guid("2f476f70-b1ef-419d-aad5-3911f1e3231f"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "16", + Order = 15, + TypeId = 3, + Value = "16" + }, + new + { + Id = new Guid("2c635ce2-fc18-47be-b3e9-98c211abf312"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "17", + Order = 16, + TypeId = 3, + Value = "17" + }, + new + { + Id = new Guid("f9d5b03b-624a-4f9f-8da3-1490ea5d2914"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "18", + Order = 17, + TypeId = 3, + Value = "18" + }, + new + { + Id = new Guid("4f4b249c-db60-4582-86ed-75cfee4edd0c"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "19", + Order = 18, + TypeId = 3, + Value = "19" + }, + new + { + Id = new Guid("220a1464-4d39-416c-b4b2-3093eb007298"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "20", + Order = 19, + TypeId = 3, + Value = "20" + }, + new + { + Id = new Guid("c887ca60-b05d-4d3c-ad1f-223c879b1a6d"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "21", + Order = 20, + TypeId = 3, + Value = "21" + }, + new + { + Id = new Guid("2905765d-63fb-41fe-a111-ee2f1d03d62e"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "22", + Order = 21, + TypeId = 3, + Value = "22" + }, + new + { + Id = new Guid("dbbe704a-8d6d-40e7-bd30-6974035b1fab"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "23", + Order = 22, + TypeId = 3, + Value = "23" + }, + new + { + Id = new Guid("cf7b9645-52ed-43a2-8267-267e0aed19b1"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "24", + Order = 23, + TypeId = 3, + Value = "24" + }, + new + { + Id = new Guid("454788d6-d0ad-4c07-878c-da3fd3cd05e1"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "25", + Order = 24, + TypeId = 3, + Value = "25" + }, + new + { + Id = new Guid("40d70d73-8582-4be6-a9e6-503b96ae3d49"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "26", + Order = 25, + TypeId = 3, + Value = "26" + }, + new + { + Id = new Guid("8f6610dc-ef46-4842-a57e-18d7aaa75931"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "27", + Order = 26, + TypeId = 3, + Value = "27" + }, + new + { + Id = new Guid("03858472-d4ce-47fd-9497-8051728766e4"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "28", + Order = 27, + TypeId = 3, + Value = "28" + }, + new + { + Id = new Guid("b1018e07-e90e-42ee-b399-19f3d0c14dd6"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "29", + Order = 28, + TypeId = 3, + Value = "29" + }, + new + { + Id = new Guid("a1669207-aa31-40fe-98d0-d941008d1655"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "30", + Order = 29, + TypeId = 3, + Value = "30" + }, + new + { + Id = new Guid("0936aa99-73e0-43de-b6df-334c1228a226"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "31", + Order = 30, + TypeId = 3, + Value = "31" + }, + new + { + Id = new Guid("626ca076-f09e-4a7a-8610-b7de6337b24a"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "1", + Order = 0, + TypeId = 4, + Value = "Первый" + }, + new + { + Id = new Guid("032fbd02-67d0-4b8c-bed0-42629ab7113b"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "2", + Order = 1, + TypeId = 4, + Value = "Второй" + }, + new + { + Id = new Guid("fa8a8f60-e41e-495e-ac86-35174d9976bf"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "3", + Order = 2, + TypeId = 4, + Value = "Третий" + }, + new + { + Id = new Guid("d2f90168-2b49-42f2-820b-79db2c522adf"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "4", + Order = 3, + TypeId = 4, + Value = "Четвертый" + }, + new + { + Id = new Guid("12bb8db2-cf7f-4113-baff-6883770f1ba5"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "5", + Order = 4, + TypeId = 4, + Value = "Последний" + }, + new + { + Id = new Guid("18260e91-3fbe-4401-9edc-78dbc419370e"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "1", + Order = 0, + TypeId = 5, + Value = "Январь" + }, + new + { + Id = new Guid("361526aa-3e1c-452e-bb44-0ade8521830d"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "2", + Order = 1, + TypeId = 5, + Value = "Февраль" + }, + new + { + Id = new Guid("fad4bdb0-6c51-4810-a30b-6d031a0d4c46"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "3", + Order = 2, + TypeId = 5, + Value = "Март" + }, + new + { + Id = new Guid("06ab835d-3d3e-4057-8422-a553b6b40995"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "4", + Order = 3, + TypeId = 5, + Value = "Апрель" + }, + new + { + Id = new Guid("83f56b5d-b16b-4aa5-89d7-a253fee4e4ad"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "5", + Order = 4, + TypeId = 5, + Value = "Май" + }, + new + { + Id = new Guid("e679ec84-a9ee-4bed-a051-2b14edddcb18"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "6", + Order = 5, + TypeId = 5, + Value = "Июнь" + }, + new + { + Id = new Guid("d439808a-6a10-409b-8809-a755b7cca60b"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "7", + Order = 6, + TypeId = 5, + Value = "Июль" + }, + new + { + Id = new Guid("6e9972c4-6bf7-4fe4-b4ea-bbb333fb69c8"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "8", + Order = 7, + TypeId = 5, + Value = "Август" + }, + new + { + Id = new Guid("0883aac2-9d5b-4098-b672-c684d2a3a0c9"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "9", + Order = 8, + TypeId = 5, + Value = "Сентябрь" + }, + new + { + Id = new Guid("5e6592bc-acb2-45a4-979b-fdecf8457453"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "10", + Order = 9, + TypeId = 5, + Value = "Октябрь" + }, + new + { + Id = new Guid("edd7cb49-d6a0-4969-b2d6-1967da69b336"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "11", + Order = 10, + TypeId = 5, + Value = "Ноябрь" + }, + new + { + Id = new Guid("dd695fb2-4ad0-4cda-a4df-e15059c56b24"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "12", + Order = 11, + TypeId = 5, + Value = "Декабрь" + }, + new + { + Id = new Guid("2f473624-4eb3-49b4-a4b9-cc7fc08a50f5"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "1", + Order = 0, + TypeId = 6, + Value = "Января" + }, + new + { + Id = new Guid("f0003490-a249-44bd-814f-4566999915d8"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "2", + Order = 1, + TypeId = 6, + Value = "Февраля" + }, + new + { + Id = new Guid("f4c3fe38-aeaa-42f7-a9ba-190ea2dfe339"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "3", + Order = 2, + TypeId = 6, + Value = "Марта" + }, + new + { + Id = new Guid("06a8bd2f-68e1-42f5-961c-ac3b98a2181e"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "4", + Order = 3, + TypeId = 6, + Value = "Апреля" + }, + new + { + Id = new Guid("963b9c41-d607-444a-9fe0-fe429590e326"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "5", + Order = 4, + TypeId = 6, + Value = "Мая" + }, + new + { + Id = new Guid("ec8554c8-dee4-49a1-b1b7-474ad8ec1473"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "6", + Order = 5, + TypeId = 6, + Value = "Июня" + }, + new + { + Id = new Guid("e15c7c63-e29f-41a3-9c82-f70eb6c24fde"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "7", + Order = 6, + TypeId = 6, + Value = "Июля" + }, + new + { + Id = new Guid("0b1f3cea-301a-4d74-9ce1-2cd93b41897d"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "8", + Order = 7, + TypeId = 6, + Value = "Августа" + }, + new + { + Id = new Guid("e2fa3769-f66f-4753-a161-35adad7717a5"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "9", + Order = 8, + TypeId = 6, + Value = "Сентября" + }, + new + { + Id = new Guid("c1de4aca-9f49-48ae-9279-cf9ec4092112"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "10", + Order = 9, + TypeId = 6, + Value = "Октября" + }, + new + { + Id = new Guid("a74b9ebd-bcd8-4537-b371-194de2fe0a4d"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "11", + Order = 10, + TypeId = 6, + Value = "Ноября" + }, + new + { + Id = new Guid("852a5ebd-4545-494b-bc69-c27409a41adc"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "12", + Order = 11, + TypeId = 6, + Value = "Декабря" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchValue", b => + { + b.Property("ApplicationsInWorkId") + .HasColumnType("uuid"); + + b.Property("TypeValueId") + .HasColumnType("uuid"); + + b.Property("TypeConfigId") + .HasColumnType("uuid"); + + b.HasKey("ApplicationsInWorkId", "TypeValueId", "TypeConfigId"); + + b.HasIndex("TypeConfigId"); + + b.HasIndex("TypeValueId"); + + b.ToTable("EsppSchValues"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Host", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Ek") + .IsRequired() + .HasColumnType("text"); + + b.Property("EkStatusCode") + .HasColumnType("integer"); + + b.Property("IP") + .HasColumnType("text"); + + b.Property("LastLogon") + .HasColumnType("timestamp with time zone"); + + b.Property("ResponseAreaCode") + .HasColumnType("integer"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("EkStatusCode"); + + b.HasIndex("ResponseAreaCode"); + + b.HasIndex("Ek", "IP"); + + b.ToTable("Hosts"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpirationDate") + .HasColumnType("timestamp with time zone"); + + b.Property("GenerateDate") + .HasColumnType("timestamp with time zone"); + + b.Property("NextStatusCode") + .HasColumnType("integer"); + + b.Property("Number") + .IsRequired() + .HasColumnType("text"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("text"); + + b.Property("StatusCode") + .HasColumnType("integer"); + + b.Property("TemplateId") + .HasColumnType("uuid"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("NextStatusCode"); + + b.HasIndex("Number") + .IsUnique(); + + b.HasIndex("StatusCode"); + + b.HasIndex("TemplateId"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("PARR.DAL.Models.OrderStatus", b => + { + b.Property("Code") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Code")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Code"); + + b.ToTable("OrderStatuses"); + + b.HasData( + new + { + Code = 1, + Description = "1-Направлен в группу", + Name = "New" + }, + new + { + Code = 2, + Description = "2-В работе", + Name = "InWork" + }, + new + { + Code = 3, + Description = "3-Приостановлен", + Name = "Stop" + }, + new + { + Code = 4, + Description = "4-Выполнен", + Name = "Complete" + }, + new + { + Code = 5, + Description = "5-Закрыт", + Name = "Closed" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Process", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("EsppId") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Processes"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ResponseArea", b => + { + b.Property("Code") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Code")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Code"); + + b.ToTable("ResponseAreas"); + + b.HasData( + new + { + Code = 96, + Name = "96-ДВС" + }, + new + { + Code = 94, + Name = "94-ЗАБ" + }, + new + { + Code = 92, + Name = "92-ВСИБ" + }, + new + { + Code = 88, + Name = "88-КРАСН" + }, + new + { + Code = 83, + Name = "83-ЗСИБ" + }, + new + { + Code = 80, + Name = "80-ЮУР" + }, + new + { + Code = 76, + Name = "76-СВРД" + }, + new + { + Code = 63, + Name = "63-КБШ" + }, + new + { + Code = 61, + Name = "61-ПРИВ" + }, + new + { + Code = 58, + Name = "58-ЮВСТ" + }, + new + { + Code = 51, + Name = "51-СКВ" + }, + new + { + Code = 28, + Name = "28-СЕВ" + }, + new + { + Code = 24, + Name = "24-ГОР" + }, + new + { + Code = 17, + Name = "17-МСК" + }, + new + { + Code = 10, + Name = "10-КЛГ" + }, + new + { + Code = 1, + Name = "01-ОКТ" + }, + new + { + Code = 99, + Name = "00-ГВЦ" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Robot", b => + { + b.Property("Code") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Code")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Code"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Robots"); + + b.HasData( + new + { + Code = 1, + Description = "Робот по созданию/изменению шаблона наряда ЕСПП", + Name = "TemplateOrder" + }, + new + { + Code = 2, + Description = "Робот по созданию/изменению расписания шаблона наряда в ЕСПП", + Name = "ScheduleOrder" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotConfiguration", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AttemptsNumber") + .HasColumnType("integer"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("LastRobotStatusUpdated") + .HasColumnType("timestamp with time zone"); + + b.Property("RobotCode") + .HasColumnType("integer"); + + b.Property("RobotStatusCode") + .HasColumnType("integer"); + + b.Property("TaskStatusCode") + .HasColumnType("integer"); + + b.Property("TemplateId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RobotCode"); + + b.HasIndex("RobotStatusCode"); + + b.HasIndex("TaskStatusCode"); + + b.HasIndex("TemplateId", "RobotCode") + .IsUnique(); + + b.ToTable("RobotConfigurations"); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("EsppMessage") + .HasColumnType("text"); + + b.Property("HistoryLevel") + .HasColumnType("integer"); + + b.Property("RobotConfigurationId") + .HasColumnType("uuid"); + + b.Property("RobotMessage") + .HasColumnType("text"); + + b.Property("TaskStatusCode") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("HistoryLevel"); + + b.HasIndex("RobotConfigurationId"); + + b.HasIndex("TaskStatusCode"); + + b.ToTable("RobotHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotHistoryLevel", b => + { + b.Property("Level") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Level")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Level"); + + b.ToTable("RobotHistoryLevels"); + + b.HasData( + new + { + Level = 1, + Description = "Робот начал работу ", + Name = "Start" + }, + new + { + Level = 5, + Description = "Информация", + Name = "Information" + }, + new + { + Level = 10, + Description = "Ошибка", + Name = "Error" + }, + new + { + Level = 15, + Description = "Успешно завершил работу", + Name = "Complete" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotStatus", b => + { + b.Property("Code") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Code")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Code"); + + b.ToTable("RobotStatuses"); + + b.HasData( + new + { + Code = 11, + Description = "Ожидание, ждет пока робот возьмет в работу.", + Name = "Wait" + }, + new + { + Code = 22, + Description = "Робот взял в работу.", + Name = "InProgress" + }, + new + { + Code = 33, + Description = "Ошибка отработки роботом. Требует ручного вмешательства.", + Name = "Error" + }, + new + { + Code = 44, + Description = "Робот успешно отработал.", + Name = "Complete" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Roles"); + + b.HasData( + new + { + Id = new Guid("c8f2f144-e6c2-45d7-ba66-5e9bbd376376"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Администратор", + Name = "administrator" + }, + new + { + Id = new Guid("13bca225-7fa4-42fa-9d80-d2d46de261fe"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Робот ЕСПП", + Name = "espp-robot" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Setting", b => + { + b.Property("Name") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Value") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Name"); + + b.ToTable("Settings"); + + b.HasData( + new + { + Name = "Initiator", + Description = "Инициатор регламентной работы, указывается при создании шаблона в ЕСПП.", + Value = "НАГИМОВ ПАВЕЛ БОРИСОВИЧ (5000966)" + }, + new + { + Name = "ClosingCode", + Description = "Код закрытия регламентной работы, указывается при создании шаблона в ЕСПП.", + Value = "выполнен" + }, + new + { + Name = "Category", + Description = "Категория создаваемого объекта в ЕСПП", + Value = "регламентная работа" + }, + new + { + Name = "TemplatePrefixName", + Description = "Префикс имени шаблона в ЕСПП", + Value = "%PREFIX%-ЭИТИ-ПТК-ПАРР" + }, + new + { + Name = "RobotAttemptsNumber", + Description = "Количество попыток выполнения задания роботом", + Value = "3" + }, + new + { + Name = "RobotWaitTime", + Description = "Время ожидания выполнения роботом задания", + Value = "00:15:00" + }, + new + { + Name = "ScheduleTimezone", + Description = "Расписание регламентной работы - В каком часовом поясе", + Value = "Greenwich/Universal" + }, + new + { + Name = "ScheduleExclude", + Description = "Расписание регламентной работы - Тип исключения", + Value = "Нет исключений" + }, + new + { + Name = "ScheduleRepeatRange", + Description = "Расписание регламентной работы - Диапазн повторов", + Value = "Отсутствует дата завершения" + }, + new + { + Name = "OrderSearchDeltaDate", + Description = "Промежуток времени для поиска нарядов в ЕСПП", + Value = "01:30:00" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Subprocess", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("EsppId") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProcessId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ProcessId"); + + b.ToTable("Subprocesses"); + }); + + modelBuilder.Entity("PARR.DAL.Models.TaskStatus", b => + { + b.Property("Code") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Code")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Code"); + + b.ToTable("TaskStatuses"); + + b.HasData( + new + { + Code = 10, + Description = "Требуется создание объекта в ЕСПП", + Name = "Creating" + }, + new + { + Code = 20, + Description = "Требуется обновление объекта в ЕСПП", + Name = "Updating" + }, + new + { + Code = 30, + Description = "Нормальное состояние объекта в ЕСПП и ПАРР. ОБъект в ПАРР соответствует объекту в ЕСПП", + Name = "Ok" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Template", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationInWorkId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("HostId") + .HasColumnType("uuid"); + + b.Property("IsActiveSchedule") + .HasColumnType("boolean"); + + b.Property("IsActiveTemplate") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ScheduleEsppId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationInWorkId"); + + b.HasIndex("HostId"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Templates"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Tnk", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("EsppId") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("SubprocessId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("SubprocessId"); + + b.ToTable("Tnks"); + }); + + modelBuilder.Entity("PARR.DAL.Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Ip") + .IsRequired() + .HasColumnType("text"); + + b.Property("LastLogon") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("Ip") + .IsUnique(); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("PARR.DAL.Models.UsersInRole", b => + { + b.Property("RoleId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("RoleId", "UserId"); + + b.HasIndex("UserId"); + + b.ToTable("UsersInRoles"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Work", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("EsppId") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("TnkId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("TnkId"); + + b.ToTable("Works"); + }); + + modelBuilder.Entity("PARR.DAL.Models.AgentHistory", b => + { + b.HasOne("PARR.DAL.Models.AgentHistoryLevel", "AgentHistoryLevel") + .WithMany("AgentHistories") + .HasForeignKey("HistoryLevelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Order", "Order") + .WithMany("AgentHistories") + .HasForeignKey("OrderId"); + + b.HasOne("PARR.DAL.Models.Template", "Template") + .WithMany("AgentHistories") + .HasForeignKey("TemplateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AgentHistoryLevel"); + + b.Navigation("Order"); + + b.Navigation("Template"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Application", b => + { + b.HasOne("PARR.DAL.Models.ApplicationType", "ApplicationType") + .WithMany("Applications") + .HasForeignKey("ApplicationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationType"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b => + { + b.HasOne("PARR.DAL.Models.Application", "Application") + .WithMany("ApplicationsInHosts") + .HasForeignKey("ApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Host", "Host") + .WithMany("ApplicationsInHosts") + .HasForeignKey("HostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Application"); + + b.Navigation("Host"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationsInWork", b => + { + b.HasOne("PARR.DAL.Models.Application", "Application") + .WithMany("ApplicationsInWorks") + .HasForeignKey("ApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Work", "Work") + .WithMany("ApplicationsInWorks") + .HasForeignKey("WorkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Application"); + + b.Navigation("Work"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeConfig", b => + { + b.HasOne("PARR.DAL.Models.EsppSchType", "EsppSchType") + .WithMany("EsppSchTypeConfigs") + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.EsppSchTypeSchedule", "EsppSchTypeSchedule") + .WithMany("EsppSchTypeConfigs") + .HasForeignKey("TypeScheduleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EsppSchType"); + + b.Navigation("EsppSchTypeSchedule"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeValue", b => + { + b.HasOne("PARR.DAL.Models.EsppSchType", "EsppSchType") + .WithMany("EsppSchTypeValues") + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EsppSchType"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchValue", b => + { + b.HasOne("PARR.DAL.Models.ApplicationsInWork", "ApplicationsInWork") + .WithMany("EsppSchValues") + .HasForeignKey("ApplicationsInWorkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.EsppSchTypeConfig", "EsppSchTypeConfig") + .WithMany("EsppSchValues") + .HasForeignKey("TypeConfigId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.EsppSchTypeValue", "EsppSchTypeValue") + .WithMany("EsppSchValues") + .HasForeignKey("TypeValueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationsInWork"); + + b.Navigation("EsppSchTypeConfig"); + + b.Navigation("EsppSchTypeValue"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Host", b => + { + b.HasOne("PARR.DAL.Models.EkStatus", "EkStatus") + .WithMany("Hosts") + .HasForeignKey("EkStatusCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.ResponseArea", "ResponseArea") + .WithMany("Hosts") + .HasForeignKey("ResponseAreaCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EkStatus"); + + b.Navigation("ResponseArea"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Order", b => + { + b.HasOne("PARR.DAL.Models.OrderStatus", "NextStatus") + .WithMany("OrdersNext") + .HasForeignKey("NextStatusCode"); + + b.HasOne("PARR.DAL.Models.OrderStatus", "OrderStatus") + .WithMany("Orders") + .HasForeignKey("StatusCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Template", "Template") + .WithMany("Orders") + .HasForeignKey("TemplateId"); + + b.Navigation("NextStatus"); + + b.Navigation("OrderStatus"); + + b.Navigation("Template"); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotConfiguration", b => + { + b.HasOne("PARR.DAL.Models.Robot", "Robot") + .WithMany("RobotConfigurations") + .HasForeignKey("RobotCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.RobotStatus", "RobotStatus") + .WithMany("RobotConfigurations") + .HasForeignKey("RobotStatusCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.TaskStatus", "TaskStatus") + .WithMany("RobotConfigurations") + .HasForeignKey("TaskStatusCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Template", "Template") + .WithMany("RobotConfigurations") + .HasForeignKey("TemplateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Robot"); + + b.Navigation("RobotStatus"); + + b.Navigation("TaskStatus"); + + b.Navigation("Template"); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotHistory", b => + { + b.HasOne("PARR.DAL.Models.RobotHistoryLevel", "RobotHistoryLevel") + .WithMany("RobotHistories") + .HasForeignKey("HistoryLevel") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.RobotConfiguration", "RobotConfiguration") + .WithMany("RobotHistories") + .HasForeignKey("RobotConfigurationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.TaskStatus", "StatusTask") + .WithMany("RobotHistories") + .HasForeignKey("TaskStatusCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("RobotConfiguration"); + + b.Navigation("RobotHistoryLevel"); + + b.Navigation("StatusTask"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Subprocess", b => + { + b.HasOne("PARR.DAL.Models.Process", "Process") + .WithMany("Subprocesses") + .HasForeignKey("ProcessId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Process"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Template", b => + { + b.HasOne("PARR.DAL.Models.ApplicationsInWork", "ApplicationsInWork") + .WithMany("Templates") + .HasForeignKey("ApplicationInWorkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Host", "Host") + .WithMany("Templates") + .HasForeignKey("HostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationsInWork"); + + b.Navigation("Host"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Tnk", b => + { + b.HasOne("PARR.DAL.Models.Subprocess", "Subprocess") + .WithMany("Tnks") + .HasForeignKey("SubprocessId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Subprocess"); + }); + + modelBuilder.Entity("PARR.DAL.Models.UsersInRole", b => + { + b.HasOne("PARR.DAL.Models.Role", "Role") + .WithMany("Users") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.User", "User") + .WithMany("Roles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Role"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Work", b => + { + b.HasOne("PARR.DAL.Models.Tnk", "Tnk") + .WithMany("Works") + .HasForeignKey("TnkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tnk"); + }); + + modelBuilder.Entity("PARR.DAL.Models.AgentHistoryLevel", b => + { + b.Navigation("AgentHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Application", b => + { + b.Navigation("ApplicationsInHosts"); + + b.Navigation("ApplicationsInWorks"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b => + { + b.Navigation("Applications"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationsInWork", b => + { + b.Navigation("EsppSchValues"); + + b.Navigation("Templates"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EkStatus", b => + { + b.Navigation("Hosts"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchType", b => + { + b.Navigation("EsppSchTypeConfigs"); + + b.Navigation("EsppSchTypeValues"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeConfig", b => + { + b.Navigation("EsppSchValues"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeSchedule", b => + { + b.Navigation("EsppSchTypeConfigs"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeValue", b => + { + b.Navigation("EsppSchValues"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Host", b => + { + b.Navigation("ApplicationsInHosts"); + + b.Navigation("Templates"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Order", b => + { + b.Navigation("AgentHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.OrderStatus", b => + { + b.Navigation("Orders"); + + b.Navigation("OrdersNext"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Process", b => + { + b.Navigation("Subprocesses"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ResponseArea", b => + { + b.Navigation("Hosts"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Robot", b => + { + b.Navigation("RobotConfigurations"); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotConfiguration", b => + { + b.Navigation("RobotHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotHistoryLevel", b => + { + b.Navigation("RobotHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotStatus", b => + { + b.Navigation("RobotConfigurations"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Role", b => + { + b.Navigation("Users"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Subprocess", b => + { + b.Navigation("Tnks"); + }); + + modelBuilder.Entity("PARR.DAL.Models.TaskStatus", b => + { + b.Navigation("RobotConfigurations"); + + b.Navigation("RobotHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Template", b => + { + b.Navigation("AgentHistories"); + + b.Navigation("Orders"); + + b.Navigation("RobotConfigurations"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Tnk", b => + { + b.Navigation("Works"); + }); + + modelBuilder.Entity("PARR.DAL.Models.User", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Work", b => + { + b.Navigation("ApplicationsInWorks"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/PARR.DAL/Migrations/20240417231927_TblApplicationTypeAddValues.cs b/PARR.DAL/Migrations/20240417231927_TblApplicationTypeAddValues.cs new file mode 100644 index 00000000..e5dc6cb4 --- /dev/null +++ b/PARR.DAL/Migrations/20240417231927_TblApplicationTypeAddValues.cs @@ -0,0 +1,94 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + +namespace PARR.DAL.Migrations +{ + /// + public partial class TblApplicationTypeAddValues : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.UpdateData( + table: "ApplicationTypes", + keyColumn: "Id", + keyValue: new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"), + column: "Description", + value: "Сервер приложений"); + + migrationBuilder.UpdateData( + table: "ApplicationTypes", + keyColumn: "Id", + keyValue: new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"), + column: "Description", + value: "ОС"); + + migrationBuilder.UpdateData( + table: "ApplicationTypes", + keyColumn: "Id", + keyValue: new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"), + column: "Description", + value: "СУБД"); + + migrationBuilder.InsertData( + table: "ApplicationTypes", + columns: new[] { "Id", "DateCreated", "DateModified", "Description", "Name" }, + values: new object[,] + { + { new Guid("0bd96f9b-d36b-4dfb-bd8a-9c356bc6912b"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "ИБ", "IB" }, + { new Guid("4466148b-510d-4423-a58f-ce878152ff01"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Инфраструктура", "SI" }, + { new Guid("725a96db-358e-489b-a7c9-a84b06ec15df"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Мониторинг", "SM" }, + { new Guid("749f4c34-b883-4f28-90dd-c161dd3c4270"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "ЦК БС", "CKBS" } + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DeleteData( + table: "ApplicationTypes", + keyColumn: "Id", + keyValue: new Guid("0bd96f9b-d36b-4dfb-bd8a-9c356bc6912b")); + + migrationBuilder.DeleteData( + table: "ApplicationTypes", + keyColumn: "Id", + keyValue: new Guid("4466148b-510d-4423-a58f-ce878152ff01")); + + migrationBuilder.DeleteData( + table: "ApplicationTypes", + keyColumn: "Id", + keyValue: new Guid("725a96db-358e-489b-a7c9-a84b06ec15df")); + + migrationBuilder.DeleteData( + table: "ApplicationTypes", + keyColumn: "Id", + keyValue: new Guid("749f4c34-b883-4f28-90dd-c161dd3c4270")); + + migrationBuilder.UpdateData( + table: "ApplicationTypes", + keyColumn: "Id", + keyValue: new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"), + column: "Description", + value: "Поле СП xml АИХ ИТ"); + + migrationBuilder.UpdateData( + table: "ApplicationTypes", + keyColumn: "Id", + keyValue: new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"), + column: "Description", + value: "Поле ОС xml АИХ ИТ"); + + migrationBuilder.UpdateData( + table: "ApplicationTypes", + keyColumn: "Id", + keyValue: new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"), + column: "Description", + value: "Поле СУБД xml АИХ ИТ"); + } + } +} diff --git a/PARR.DAL/Migrations/DataContextModelSnapshot.cs b/PARR.DAL/Migrations/DataContextModelSnapshot.cs index 74489781..0ead2482 100644 --- a/PARR.DAL/Migrations/DataContextModelSnapshot.cs +++ b/PARR.DAL/Migrations/DataContextModelSnapshot.cs @@ -173,22 +173,50 @@ namespace PARR.DAL.Migrations { Id = new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"), DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), - Description = "Поле СП xml АИХ ИТ", + Description = "Сервер приложений", Name = "APP" }, new { Id = new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"), DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), - Description = "Поле ОС xml АИХ ИТ", + Description = "ОС", Name = "OS" }, new { Id = new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"), DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), - Description = "Поле СУБД xml АИХ ИТ", + Description = "СУБД", Name = "DB" + }, + new + { + Id = new Guid("749f4c34-b883-4f28-90dd-c161dd3c4270"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "ЦК БС", + Name = "CKBS" + }, + new + { + Id = new Guid("0bd96f9b-d36b-4dfb-bd8a-9c356bc6912b"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "ИБ", + Name = "IB" + }, + new + { + Id = new Guid("4466148b-510d-4423-a58f-ce878152ff01"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Инфраструктура", + Name = "SI" + }, + new + { + Id = new Guid("725a96db-358e-489b-a7c9-a84b06ec15df"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Мониторинг", + Name = "SM" }); }); diff --git a/PARR.DAL/Services/Implementations/HostService.cs b/PARR.DAL/Services/Implementations/HostService.cs index ca83f0f4..b572a673 100644 --- a/PARR.DAL/Services/Implementations/HostService.cs +++ b/PARR.DAL/Services/Implementations/HostService.cs @@ -21,73 +21,40 @@ namespace PARR.DAL.Services.Implementations this.logger = logger; } - public async Task GetHostWithAppsAsync(string IP) - { - //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) + public async Task GetHostWithAppsByIpAsync(string ip) + { + return await GetHostWithIncludeApps() .AsSplitQuery() - .FirstOrDefaultAsync(h => h.IP == IP); + .FirstOrDefaultAsync(h => h.IP == ip); } + + public async Task GetHostWithAppsByEkAsync(string ek) + { + return await GetHostWithIncludeApps() + .AsSplitQuery() + .FirstOrDefaultAsync(h => h.Ek.ToLower() == ek.ToLower()); + } + + + private IQueryable GetHostWithIncludeApps() + { + return EntitySet.Include(t => t.ApplicationsInHosts).ThenInclude(a => a.Application).ThenInclude(t => t!.ApplicationType); + } + + public async Task GetByIpAsync(string ip) { return await EntitySet.FirstOrDefaultAsync(t => t.IP == ip); } - //public async Task GetHostByRegionalEKAsync(string RegionalEK)И - //{ - // try - // { - // var host = await EntitySet.FirstAsync(h => h.RegionalEK == RegionalEK); - // return host; - // } - // catch - // { - // logger.LogInformation($"Не найден узел с региональным ЭК {RegionalEK}"); - // return null; - // } - //} - //public async Task UpdateAsync(Host host) - //{ - // var orig = await EntitySet.FirstAsync(h => h.IP == host.IP); - // if (orig == null) - // return false; + public async Task GetByEkAsync(string ek) + { + return await EntitySet.FirstOrDefaultAsync(t => t.Ek.ToLower() == ek.ToLower()); + } - // 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; - // } - - //} } } diff --git a/PARR.DAL/Services/Interfaces/IHostService.cs b/PARR.DAL/Services/Interfaces/IHostService.cs index 5188a3be..469f1b9a 100644 --- a/PARR.DAL/Services/Interfaces/IHostService.cs +++ b/PARR.DAL/Services/Interfaces/IHostService.cs @@ -5,10 +5,10 @@ namespace PARR.DAL.Services.Interfaces { public interface IHostService : IBaseService { - Task GetHostWithAppsAsync(string ip); + Task GetHostWithAppsByIpAsync(string ip); Task GetByIpAsync(string ip); - - + Task GetHostWithAppsByEkAsync(string ek); + Task GetByEkAsync(string ek); } }