From af21530d014aaa219ad46c35996dd23814deb746 Mon Sep 17 00:00:00 2001 From: Mikhail Kuznetsov Date: Fri, 1 Sep 2023 16:19:32 +1000 Subject: [PATCH] =?UTF-8?q?TemplateService.=20!!!=D0=9E=D1=88=D0=B8=D0=B1?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B7=D0=B0=D0=BF=D0=B8=D1=81=D0=B8=20=D0=B2=20?= =?UTF-8?q?=D0=91=D0=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PARR.DAL/Context/DataContext.cs | 2 +- ...20230901033940_TblTemplatesUpd.Designer.cs | 973 ++++++++++++++++++ .../20230901033940_TblTemplatesUpd.cs | 29 + .../Migrations/DataContextModelSnapshot.cs | 4 + PARR.DAL/Models/Host.cs | 1 - PARR.DAL/Models/Template.cs | 1 + PARR.DAL/ParrDalInstaller.cs | 4 +- .../Implementations/TemplateService.cs | 5 + .../Services/Interfaces/ITemplateService.cs | 1 + .../PARR.EsppTemplateSync.csproj | 1 + PARR.EsppTemplateSync/Services/Manager.cs | 68 +- .../Services/ParserService.cs | 7 +- PARR.EsppTemplateSync/TemplateMQSyncer.cs | 34 +- PARR.EsppTemplateSyncWorker/Program.cs | 2 + PARR.EsppTemplateSyncWorker/Worker.cs | 24 +- PARR.MockData/Data/EsppExport.cs | 3 +- 16 files changed, 1125 insertions(+), 34 deletions(-) create mode 100644 PARR.DAL/Migrations/20230901033940_TblTemplatesUpd.Designer.cs create mode 100644 PARR.DAL/Migrations/20230901033940_TblTemplatesUpd.cs diff --git a/PARR.DAL/Context/DataContext.cs b/PARR.DAL/Context/DataContext.cs index b311b77f..631d067a 100644 --- a/PARR.DAL/Context/DataContext.cs +++ b/PARR.DAL/Context/DataContext.cs @@ -6,7 +6,7 @@ using PARR.DAL.Models.V1; namespace PARR.DAL.Context { - internal class DataContext : DbContext + public class DataContext : DbContext { public DataContext(DbContextOptions options) : base(options) { } diff --git a/PARR.DAL/Migrations/20230901033940_TblTemplatesUpd.Designer.cs b/PARR.DAL/Migrations/20230901033940_TblTemplatesUpd.Designer.cs new file mode 100644 index 00000000..a01f56c5 --- /dev/null +++ b/PARR.DAL/Migrations/20230901033940_TblTemplatesUpd.Designer.cs @@ -0,0 +1,973 @@ +// +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("20230901033940_TblTemplatesUpd")] + partial class TblTemplatesUpd + { + /// + 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.AIHIT.RawDataEK", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AIHID") + .HasColumnType("integer"); + + b.Property("APPType") + .HasColumnType("text"); + + b.Property("AdditionalInfo") + .HasColumnType("text"); + + b.Property("CKBSServerType") + .HasColumnType("text"); + + b.Property("CTSDirection") + .HasColumnType("text"); + + b.Property("ClientOS") + .HasColumnType("text"); + + b.Property("ClientSoftware") + .HasColumnType("text"); + + b.Property("Company") + .HasColumnType("text"); + + b.Property("CreateTime") + .HasColumnType("text"); + + b.Property("DBType") + .HasColumnType("text"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("EKCategory") + .HasColumnType("text"); + + b.Property("EKFindCode") + .HasColumnType("text"); + + b.Property("EKRegister") + .HasColumnType("text"); + + b.Property("EKRevizor") + .HasColumnType("text"); + + b.Property("EKSubCategory") + .HasColumnType("text"); + + b.Property("EKType") + .HasColumnType("text"); + + b.Property("EndExplotationDate") + .HasColumnType("text"); + + b.Property("FullName") + .HasColumnType("text"); + + b.Property("IBServerType") + .HasColumnType("text"); + + b.Property("IP") + .HasColumnType("text"); + + b.Property("InfrastructureServerType") + .HasColumnType("text"); + + b.Property("IsActive") + .HasColumnType("text"); + + b.Property("IsImportant") + .HasColumnType("text"); + + b.Property("IsUnreliableData") + .HasColumnType("character(1)"); + + b.Property("Location") + .HasColumnType("text"); + + b.Property("Metka") + .HasColumnType("text"); + + b.Property("MonitoringServerType") + .HasColumnType("text"); + + b.Property("NetworkName") + .HasColumnType("text"); + + b.Property("NewEKFindCode") + .HasColumnType("text"); + + b.Property("OldEKFindCode") + .HasColumnType("text"); + + b.Property("PlannedTimeToRepair") + .HasColumnType("text"); + + b.Property("Prescription") + .HasColumnType("text"); + + b.Property("ProductCode") + .HasColumnType("text"); + + b.Property("ResponseArea") + .HasColumnType("text"); + + b.Property("ResponsibleByEK") + .HasColumnType("text"); + + b.Property("ServiceCode") + .HasColumnType("text"); + + b.Property("ShiftWorkGroup") + .HasColumnType("text"); + + b.Property("ShortName") + .HasColumnType("text"); + + b.Property("StartExplotationDate") + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("text"); + + b.Property("SysModTime") + .HasColumnType("text"); + + b.Property("SysModUser") + .HasColumnType("text"); + + b.Property("TargetRepairTime") + .HasColumnType("text"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("RawDataEKs", "AIHIT"); + }); + + modelBuilder.Entity("PARR.DAL.Models.AIHIT.Setting", 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("Group") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Value") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Settings", "AIHIT"); + + b.HasData( + new + { + Id = new Guid("1ad12210-be62-459a-aa6c-fda7648503f7"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Строка подключения к базе данных АИХ ИТ", + Name = "ConnectionString", + Value = "Data Source=10.248.19.97; Initial Catalog=mao2;User ID=awhit-ipp-parr;pwd=ET3h$9y1LH#D;TrustServerCertificate=true;" + }, + new + { + Id = new Guid("50f66704-4d26-4587-bb1e-dca70c8f4b89"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Зона ответственности", + Group = "ResponsibleArea", + Name = "ZAB", + Value = "94-ЗАБ" + }, + new + { + Id = new Guid("1fd43634-4a06-4237-9727-edfa6f3eebe8"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Зона ответственности", + Group = "ResponsibleArea", + Name = "DVS", + Value = "96-ДВС" + }, + new + { + Id = new Guid("77c73c0a-8e4d-4676-b6e2-6a112f20e346"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Статус актуальных ЭК", + Group = "Status", + Name = "Exploitation", + Value = "3-В эксплуатации" + }); + }); + + 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.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("ApplicationTypeId") + .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.HasIndex("ApplicationTypeId"); + + 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 = "Поле СП xml АИХ ИТ", + 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 АИХ ИТ", + 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 АИХ ИТ", + Name = "DB" + }); + }); + + 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("HostName") + .HasColumnType("text"); + + b.Property("IP") + .IsRequired() + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("text"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Hosts"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Template", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Category") + .IsRequired() + .HasColumnType("text"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("EK") + .IsRequired() + .HasColumnType("text"); + + b.Property("EKDateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Process") + .IsRequired() + .HasColumnType("text"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("text"); + + b.Property("Status") + .IsRequired() + .HasColumnType("text"); + + b.Property("SubProcess") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkGroup") + .IsRequired() + .HasColumnType("text"); + + b.Property("isActive") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.ToTable("Templates"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_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.ToTable("V1_Applications"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_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.Property("V1_ApplicationId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationId"); + + b.HasIndex("HostId"); + + b.HasIndex("V1_ApplicationId"); + + b.ToTable("V1_ApplicationsInHost"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_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.Property("V1_ApplicationTypeId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("V1_ApplicationTypeId"); + + b.ToTable("V1_ApplicationTypes"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_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("HostName") + .HasColumnType("text"); + + b.Property("IP") + .IsRequired() + .HasColumnType("text"); + + b.Property("LinkEK") + .HasColumnType("text"); + + b.Property("RegionalEK") + .HasColumnType("text"); + + b.Property("Responsible") + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("text"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("V1_Hosts"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", 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("Frequency") + .HasColumnType("integer"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("JobCategoryId") + .HasColumnType("uuid"); + + b.Property("JobModeId") + .HasColumnType("uuid"); + + b.Property("JobTypeId") + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ScriptName") + .IsRequired() + .HasColumnType("text"); + + b.Property("StartAt") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationId"); + + b.HasIndex("JobCategoryId"); + + b.HasIndex("JobModeId"); + + b.HasIndex("JobTypeId"); + + b.ToTable("V1_Jobs"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobCategory", 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("V1_JobCategorys"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobJournal", 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("DateOper") + .HasColumnType("timestamp with time zone"); + + b.Property("HostId") + .HasColumnType("uuid"); + + b.Property("Info") + .HasColumnType("text"); + + b.Property("JobId") + .HasColumnType("uuid"); + + b.Property("JobStatusId") + .HasColumnType("uuid"); + + b.Property("Other") + .HasColumnType("text"); + + b.Property("TimeOut") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("HostId"); + + b.HasIndex("JobId"); + + b.HasIndex("JobStatusId"); + + b.ToTable("V1_JobJournals"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobMode", 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("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("V1_JobModes"); + + b.HasData( + new + { + Id = new Guid("fba4202c-5bad-49c4-b076-d1ca6e1fb158"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "auto" + }, + new + { + Id = new Guid("7516b952-510d-4aaa-971c-a14b184fc1d5"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "manual" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobStatus", 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("V1_JobStatuses"); + + b.HasData( + new + { + Id = new Guid("edef6dc3-adad-4c77-8ad1-63bb9052355a"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Задание запущено", + Name = "started" + }, + new + { + Id = new Guid("7b945eb6-d885-4570-aff5-8866f1f75ff2"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Задание выполнено", + Name = "finished" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobType", 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("V1_JobTypes"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Application", b => + { + b.HasOne("PARR.DAL.Models.ApplicationType", "ApplicationType") + .WithMany() + .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.ApplicationType", b => + { + b.HasOne("PARR.DAL.Models.ApplicationType", null) + .WithMany("ApplicationTypes") + .HasForeignKey("ApplicationTypeId"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b => + { + b.HasOne("PARR.DAL.Models.V1.V1_ApplicationType", "ApplicationType") + .WithMany() + .HasForeignKey("ApplicationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationType"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationInHost", b => + { + b.HasOne("PARR.DAL.Models.Application", "Application") + .WithMany() + .HasForeignKey("ApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.V1.V1_Host", "Host") + .WithMany("ApplicationsInHosts") + .HasForeignKey("HostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.V1.V1_Application", null) + .WithMany("V1_ApplicationsInHosts") + .HasForeignKey("V1_ApplicationId"); + + b.Navigation("Application"); + + b.Navigation("Host"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationType", b => + { + b.HasOne("PARR.DAL.Models.V1.V1_ApplicationType", null) + .WithMany("V1_ApplicationTypes") + .HasForeignKey("V1_ApplicationTypeId"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b => + { + b.HasOne("PARR.DAL.Models.Application", "Application") + .WithMany() + .HasForeignKey("ApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.V1.V1_JobCategory", "JobCategorye") + .WithMany("Jobs") + .HasForeignKey("JobCategoryId"); + + b.HasOne("PARR.DAL.Models.V1.V1_JobMode", "JobMode") + .WithMany("Jobs") + .HasForeignKey("JobModeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.V1.V1_JobType", "JobType") + .WithMany("Jobs") + .HasForeignKey("JobTypeId"); + + b.Navigation("Application"); + + b.Navigation("JobCategorye"); + + b.Navigation("JobMode"); + + b.Navigation("JobType"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobJournal", b => + { + b.HasOne("PARR.DAL.Models.V1.V1_Host", "Host") + .WithMany("JobJournals") + .HasForeignKey("HostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.V1.V1_Job", "Job") + .WithMany("Journals") + .HasForeignKey("JobId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.V1.V1_JobStatus", "Status") + .WithMany("Journals") + .HasForeignKey("JobStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Host"); + + b.Navigation("Job"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Application", b => + { + b.Navigation("ApplicationsInHosts"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b => + { + b.Navigation("ApplicationTypes"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Host", b => + { + b.Navigation("ApplicationsInHosts"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b => + { + b.Navigation("V1_ApplicationsInHosts"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationType", b => + { + b.Navigation("V1_ApplicationTypes"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_Host", b => + { + b.Navigation("ApplicationsInHosts"); + + b.Navigation("JobJournals"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b => + { + b.Navigation("Journals"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobCategory", b => + { + b.Navigation("Jobs"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobMode", b => + { + b.Navigation("Jobs"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobStatus", b => + { + b.Navigation("Journals"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobType", b => + { + b.Navigation("Jobs"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/PARR.DAL/Migrations/20230901033940_TblTemplatesUpd.cs b/PARR.DAL/Migrations/20230901033940_TblTemplatesUpd.cs new file mode 100644 index 00000000..f644fe5b --- /dev/null +++ b/PARR.DAL/Migrations/20230901033940_TblTemplatesUpd.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace PARR.DAL.Migrations +{ + /// + public partial class TblTemplatesUpd : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Status", + table: "Templates", + type: "text", + nullable: false, + defaultValue: ""); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Status", + table: "Templates"); + } + } +} diff --git a/PARR.DAL/Migrations/DataContextModelSnapshot.cs b/PARR.DAL/Migrations/DataContextModelSnapshot.cs index efe33eea..5eb9e77b 100644 --- a/PARR.DAL/Migrations/DataContextModelSnapshot.cs +++ b/PARR.DAL/Migrations/DataContextModelSnapshot.cs @@ -405,6 +405,10 @@ namespace PARR.DAL.Migrations .IsRequired() .HasColumnType("text"); + b.Property("Status") + .IsRequired() + .HasColumnType("text"); + b.Property("SubProcess") .IsRequired() .HasColumnType("text"); diff --git a/PARR.DAL/Models/Host.cs b/PARR.DAL/Models/Host.cs index 1b671201..322bd43b 100644 --- a/PARR.DAL/Models/Host.cs +++ b/PARR.DAL/Models/Host.cs @@ -1,5 +1,4 @@ using PARR.DAL.Models.Base; -using PARR.DAL.Models.V1; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; diff --git a/PARR.DAL/Models/Template.cs b/PARR.DAL/Models/Template.cs index 68b14272..3eb48677 100644 --- a/PARR.DAL/Models/Template.cs +++ b/PARR.DAL/Models/Template.cs @@ -19,5 +19,6 @@ namespace PARR.DAL.Models public DateTimeOffset? EKDateCreated { get; set; } public required string Process { get; set; } public required string SubProcess { get; set; } + public required string Status { get; set; } } } diff --git a/PARR.DAL/ParrDalInstaller.cs b/PARR.DAL/ParrDalInstaller.cs index 2f6341e8..a97fbb8d 100644 --- a/PARR.DAL/ParrDalInstaller.cs +++ b/PARR.DAL/ParrDalInstaller.cs @@ -32,9 +32,7 @@ namespace PARR.DAL services.AddTransient(); services.AddTransient(); services.AddTransient(); - //services.AddTransient(); - - //services.AddTransient(); + services.AddTransient(); } } } diff --git a/PARR.DAL/Services/Implementations/TemplateService.cs b/PARR.DAL/Services/Implementations/TemplateService.cs index 3044d412..d76731b7 100644 --- a/PARR.DAL/Services/Implementations/TemplateService.cs +++ b/PARR.DAL/Services/Implementations/TemplateService.cs @@ -21,5 +21,10 @@ namespace PARR.DAL.Services.Implementations this.dataContext = dataContext; this.logger = logger; } + + public async Task GetTemplateByNameAsync(string name) + { + return await EntitySet.FirstOrDefaultAsync(t => t.EK == name); + } } } diff --git a/PARR.DAL/Services/Interfaces/ITemplateService.cs b/PARR.DAL/Services/Interfaces/ITemplateService.cs index 80f87518..d2c2bf3e 100644 --- a/PARR.DAL/Services/Interfaces/ITemplateService.cs +++ b/PARR.DAL/Services/Interfaces/ITemplateService.cs @@ -5,5 +5,6 @@ namespace PARR.DAL.Services.Interfaces { public interface ITemplateService : IBaseService