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

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

View File

@@ -2,8 +2,6 @@
using PARR.DAL.Contracts;
using PARR.DAL.Models;
using PARR.DAL.Models.AIHIT;
using PARR.DAL.Models.V1;
using System;
namespace PARR.DAL.Context
{
@@ -11,19 +9,6 @@ namespace PARR.DAL.Context
{
public DataContext(DbContextOptions<DataContext> options) : base(options) { }
#region v1
public DbSet<V1_JobType> JobTypes { get; set; }
public DbSet<V1_JobCategory> JobCategories { get; set; }
public DbSet<V1_JobMode> JobModes { get; set; }
public DbSet<V1_JobStatus> JobStatuses { get; set; }
public DbSet<V1_Host> V1_Hosts { get; set; }
public DbSet<V1_Job> Jobs { get; set; }
public DbSet<V1_JobJournal> JobJournals { get; set; }
public DbSet<V1_Application> V1_Applications { get; set; }
public DbSet<V1_ApplicationType> V1_ApplicationTypes { get; set; }
public DbSet<V1_ApplicationInHost> V1_ApplicationsInHosts { get; set; }
#endregion
public DbSet<Host> Hosts { get; set; }
public DbSet<EkStatus> EkStatuses { get; set; }
public DbSet<ResponseArea> ResponseAreas { get; set; }
@@ -64,23 +49,6 @@ namespace PARR.DAL.Context
var dateCreated = new DateTimeOffset(2023, 05, 01, 0, 0, 0, new TimeSpan(0));
modelBuilder.Entity<V1_JobMode>(f =>
{
f.HasData(
new() { Id = new Guid("FBA4202C-5BAD-49C4-B076-D1CA6E1FB158"), DateCreated = dateCreated, DateModified = null, Name = JobModeEnum.auto.ToString() },
new() { Id = new Guid("7516B952-510D-4AAA-971C-A14B184FC1D5"), DateCreated = dateCreated, DateModified = null, Name = JobModeEnum.manual.ToString() }
);
});
modelBuilder.Entity<V1_JobStatus>(f =>
{
f.HasData(
new() { Id = new Guid("EDEF6DC3-ADAD-4C77-8AD1-63BB9052355A"), DateCreated = dateCreated, DateModified = null, Name = JobStatusEnum.started.ToString(), Description = "Задание запущено" },
new() { Id = new Guid("7B945EB6-D885-4570-AFF5-8866F1F75FF2"), DateCreated = dateCreated, DateModified = null, Name = JobStatusEnum.finished.ToString(), Description = "Задание выполнено" }
);
});
modelBuilder.Entity<ApplicationType>(f =>
{
f.HasData(
@@ -179,6 +147,7 @@ namespace PARR.DAL.Context
);
});
#region Robots
modelBuilder.Entity<RobotStatus>(f =>
{
@@ -208,6 +177,8 @@ namespace PARR.DAL.Context
);
});
#endregion
#region EsppSchedules
modelBuilder.Entity<EsppSchType>(f =>

View File

@@ -1,8 +0,0 @@
namespace PARR.DAL.Contracts
{
public enum JobModeEnum
{
auto,
manual
}
}

View File

@@ -1,8 +0,0 @@
namespace PARR.DAL.Contracts
{
public enum JobStatusEnum
{
started,
finished
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,365 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class RemoveTblsV1 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "V1_ApplicationsInHost");
migrationBuilder.DropTable(
name: "V1_JobJournals");
migrationBuilder.DropTable(
name: "V1_Applications");
migrationBuilder.DropTable(
name: "V1_Hosts");
migrationBuilder.DropTable(
name: "V1_JobStatuses");
migrationBuilder.DropTable(
name: "V1_Jobs");
migrationBuilder.DropTable(
name: "V1_ApplicationTypes");
migrationBuilder.DropTable(
name: "V1_JobCategorys");
migrationBuilder.DropTable(
name: "V1_JobModes");
migrationBuilder.DropTable(
name: "V1_JobTypes");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "V1_ApplicationTypes",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Description = table.Column<string>(type: "text", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
V1_ApplicationTypeId = table.Column<Guid>(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_ApplicationTypes", x => x.Id);
table.ForeignKey(
name: "FK_V1_ApplicationTypes_V1_ApplicationTypes_V1_ApplicationTypeId",
column: x => x.V1_ApplicationTypeId,
principalTable: "V1_ApplicationTypes",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "V1_Hosts",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
HostName = table.Column<string>(type: "text", nullable: true),
IP = table.Column<string>(type: "text", nullable: false),
LinkEK = table.Column<string>(type: "text", nullable: true),
RegionalEK = table.Column<string>(type: "text", nullable: true),
Responsible = table.Column<string>(type: "text", nullable: true),
Status = table.Column<string>(type: "text", nullable: true),
WorkGroup = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_Hosts", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_JobCategorys",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Description = table.Column<string>(type: "text", nullable: true),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobCategorys", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_JobModes",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobModes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_JobStatuses",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Description = table.Column<string>(type: "text", nullable: true),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobStatuses", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_JobTypes",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Description = table.Column<string>(type: "text", nullable: true),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobTypes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_Applications",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ApplicationTypeId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_Applications", x => x.Id);
table.ForeignKey(
name: "FK_V1_Applications_V1_ApplicationTypes_ApplicationTypeId",
column: x => x.ApplicationTypeId,
principalTable: "V1_ApplicationTypes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "V1_Jobs",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ApplicationId = table.Column<Guid>(type: "uuid", nullable: false),
JobCategoryId = table.Column<Guid>(type: "uuid", nullable: true),
JobModeId = table.Column<Guid>(type: "uuid", nullable: false),
JobTypeId = table.Column<Guid>(type: "uuid", nullable: true),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Frequency = table.Column<int>(type: "integer", nullable: false),
IsEnabled = table.Column<bool>(type: "boolean", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
ScriptName = table.Column<string>(type: "text", nullable: false),
StartAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_Jobs", x => x.Id);
table.ForeignKey(
name: "FK_V1_Jobs_Applications_ApplicationId",
column: x => x.ApplicationId,
principalTable: "Applications",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_Jobs_V1_JobCategorys_JobCategoryId",
column: x => x.JobCategoryId,
principalTable: "V1_JobCategorys",
principalColumn: "Id");
table.ForeignKey(
name: "FK_V1_Jobs_V1_JobModes_JobModeId",
column: x => x.JobModeId,
principalTable: "V1_JobModes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_Jobs_V1_JobTypes_JobTypeId",
column: x => x.JobTypeId,
principalTable: "V1_JobTypes",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "V1_ApplicationsInHost",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ApplicationId = table.Column<Guid>(type: "uuid", nullable: false),
HostId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
V1_ApplicationId = table.Column<Guid>(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_ApplicationsInHost", x => x.Id);
table.ForeignKey(
name: "FK_V1_ApplicationsInHost_Applications_ApplicationId",
column: x => x.ApplicationId,
principalTable: "Applications",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_ApplicationsInHost_V1_Applications_V1_ApplicationId",
column: x => x.V1_ApplicationId,
principalTable: "V1_Applications",
principalColumn: "Id");
table.ForeignKey(
name: "FK_V1_ApplicationsInHost_V1_Hosts_HostId",
column: x => x.HostId,
principalTable: "V1_Hosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "V1_JobJournals",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
HostId = table.Column<Guid>(type: "uuid", nullable: false),
JobId = table.Column<Guid>(type: "uuid", nullable: false),
JobStatusId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
DateOper = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
Info = table.Column<string>(type: "text", nullable: true),
Other = table.Column<string>(type: "text", nullable: true),
TimeOut = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobJournals", x => x.Id);
table.ForeignKey(
name: "FK_V1_JobJournals_V1_Hosts_HostId",
column: x => x.HostId,
principalTable: "V1_Hosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_JobJournals_V1_JobStatuses_JobStatusId",
column: x => x.JobStatusId,
principalTable: "V1_JobStatuses",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_JobJournals_V1_Jobs_JobId",
column: x => x.JobId,
principalTable: "V1_Jobs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
table: "V1_JobModes",
columns: new[] { "Id", "DateCreated", "DateModified", "Name" },
values: new object[,]
{
{ new Guid("7516b952-510d-4aaa-971c-a14b184fc1d5"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "manual" },
{ new Guid("fba4202c-5bad-49c4-b076-d1ca6e1fb158"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "auto" }
});
migrationBuilder.InsertData(
table: "V1_JobStatuses",
columns: new[] { "Id", "DateCreated", "DateModified", "Description", "Name" },
values: new object[,]
{
{ new Guid("7b945eb6-d885-4570-aff5-8866f1f75ff2"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Задание выполнено", "finished" },
{ new Guid("edef6dc3-adad-4c77-8ad1-63bb9052355a"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Задание запущено", "started" }
});
migrationBuilder.CreateIndex(
name: "IX_V1_Applications_ApplicationTypeId",
table: "V1_Applications",
column: "ApplicationTypeId");
migrationBuilder.CreateIndex(
name: "IX_V1_ApplicationsInHost_ApplicationId",
table: "V1_ApplicationsInHost",
column: "ApplicationId");
migrationBuilder.CreateIndex(
name: "IX_V1_ApplicationsInHost_HostId",
table: "V1_ApplicationsInHost",
column: "HostId");
migrationBuilder.CreateIndex(
name: "IX_V1_ApplicationsInHost_V1_ApplicationId",
table: "V1_ApplicationsInHost",
column: "V1_ApplicationId");
migrationBuilder.CreateIndex(
name: "IX_V1_ApplicationTypes_V1_ApplicationTypeId",
table: "V1_ApplicationTypes",
column: "V1_ApplicationTypeId");
migrationBuilder.CreateIndex(
name: "IX_V1_JobJournals_HostId",
table: "V1_JobJournals",
column: "HostId");
migrationBuilder.CreateIndex(
name: "IX_V1_JobJournals_JobId",
table: "V1_JobJournals",
column: "JobId");
migrationBuilder.CreateIndex(
name: "IX_V1_JobJournals_JobStatusId",
table: "V1_JobJournals",
column: "JobStatusId");
migrationBuilder.CreateIndex(
name: "IX_V1_Jobs_ApplicationId",
table: "V1_Jobs",
column: "ApplicationId");
migrationBuilder.CreateIndex(
name: "IX_V1_Jobs_JobCategoryId",
table: "V1_Jobs",
column: "JobCategoryId");
migrationBuilder.CreateIndex(
name: "IX_V1_Jobs_JobModeId",
table: "V1_Jobs",
column: "JobModeId");
migrationBuilder.CreateIndex(
name: "IX_V1_Jobs_JobTypeId",
table: "V1_Jobs",
column: "JobTypeId");
}
}
}

View File

@@ -2037,353 +2037,6 @@ namespace PARR.DAL.Migrations
b.ToTable("Tnks");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationTypeId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("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<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("HostId")
.HasColumnType("uuid");
b.Property<Guid?>("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<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("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<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("HostName")
.HasColumnType("text");
b.Property<string>("IP")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LinkEK")
.HasColumnType("text");
b.Property<string>("RegionalEK")
.HasColumnType("text");
b.Property<string>("Responsible")
.HasColumnType("text");
b.Property<string>("Status")
.HasColumnType("text");
b.Property<string>("WorkGroup")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_Hosts");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<int>("Frequency")
.HasColumnType("integer");
b.Property<bool>("IsEnabled")
.HasColumnType("boolean");
b.Property<Guid?>("JobCategoryId")
.HasColumnType("uuid");
b.Property<Guid>("JobModeId")
.HasColumnType("uuid");
b.Property<Guid?>("JobTypeId")
.HasColumnType("uuid");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ScriptName")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("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<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobCategorys");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobJournal", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset>("DateOper")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("HostId")
.HasColumnType("uuid");
b.Property<string>("Info")
.HasColumnType("text");
b.Property<Guid>("JobId")
.HasColumnType("uuid");
b.Property<Guid>("JobStatusId")
.HasColumnType("uuid");
b.Property<string>("Other")
.HasColumnType("text");
b.Property<int?>("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<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("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<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("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<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobTypes");
});
modelBuilder.Entity("PARR.DAL.Models.Work", b =>
{
b.Property<Guid>("Id")
@@ -2641,105 +2294,6 @@ namespace PARR.DAL.Migrations
b.Navigation("Subprocess");
});
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.Work", b =>
{
b.HasOne("PARR.DAL.Models.Tnk", "Tnk")
@@ -2856,48 +2410,6 @@ namespace PARR.DAL.Migrations
b.Navigation("Works");
});
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");
});
modelBuilder.Entity("PARR.DAL.Models.Work", b =>
{
b.Navigation("ApplicationsInWorks");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -7,10 +7,8 @@ using PARR.DAL.Contracts;
using PARR.DAL.Services.Implementation;
using PARR.DAL.Services.Implementations;
using PARR.DAL.Services.Implementations.AIHIT;
using PARR.DAL.Services.Implementations.V1;
using PARR.DAL.Services.Interfaces;
using PARR.DAL.Services.Interfaces.AIHIT;
using PARR.DAL.Services.Interfaces.V1;
using PARR.DAL.TransformServices;
namespace PARR.DAL
@@ -31,7 +29,7 @@ namespace PARR.DAL
.UseNpgsql(configuration.GetConnectionString("DefaultConnection"))
);
services.AddTransient<V1_IHostService, V1_HostService>();
// Entity services
services.AddTransient<IHostService, HostService>();
services.AddTransient<IApplicationService, ApplicationService>();
services.AddTransient<IApplicationTypeService, ApplicationTypeService>();
@@ -42,11 +40,6 @@ namespace PARR.DAL
services.AddTransient<IProcessService, ProcessService>();
services.AddTransient<ISubprocessService, SubprocessService>();
services.AddTransient<ITnkService, TnkService>();
services.AddTransient<V1_IApplicationService, V1_ApplicationService>();
services.AddTransient<V1_IApplicationTypeService, V1_ApplicationTypeService>();
services.AddTransient<V1_IApplicationInHostService, V1_ApplicationInHostService>();
services.AddTransient<V1_IJobService, V1_JobService>();
services.AddTransient<V1_IJobJournalService, V1_JobJournalService>();
services.AddTransient<IRawDataEKService, RawDataEKService>();
services.AddTransient<ISettingService, SettingService>();
services.AddTransient<ITemplateService, TemplateService>();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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