feat(dal,api,nextRun,templateGenerator,templateActivator): IsUnused вынесена в TemplateStatusType
This commit is contained in:
@@ -24,6 +24,7 @@ namespace PARR.DAL.Context
|
||||
|
||||
public DbSet<Template> Templates { get; set; }
|
||||
public DbSet<TemplateHistory> TemplateHistories { get; set; }
|
||||
public DbSet<TemplateStatusType> TemplateStatusTypes { get; set; }
|
||||
public DbSet<Models.TaskStatus> TaskStatuses { get; set; }
|
||||
public DbSet<RobotStatus> RobotStatuses { get; set; }
|
||||
|
||||
@@ -489,6 +490,19 @@ namespace PARR.DAL.Context
|
||||
|
||||
#endregion
|
||||
|
||||
#region TemplateStatusType
|
||||
|
||||
modelBuilder.Entity<TemplateStatusType>(f =>
|
||||
{
|
||||
f.HasData(
|
||||
new() { Id = TemplateStatusTypeEnum.Used, Name = TemplateStatusTypeEnum.Used.ToString(), Description = "В работе" },
|
||||
new() { Id = TemplateStatusTypeEnum.Unused, Name = TemplateStatusTypeEnum.Unused.ToString(), Description = "Не используется" },
|
||||
new() { Id = TemplateStatusTypeEnum.Updating, Name = TemplateStatusTypeEnum.Updating.ToString(), Description = "Обновляется" }
|
||||
);
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
//protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
|
||||
12
PARR.DAL/DomainModels/HistoryInitiator.cs
Normal file
12
PARR.DAL/DomainModels/HistoryInitiator.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using PARR.Common.Domain;
|
||||
using PARR.Constants;
|
||||
|
||||
namespace PARR.DAL.DomainModels
|
||||
{
|
||||
public class HistoryInitiator : IHistoryInitiator
|
||||
{
|
||||
string? IHistoryInitiator.InitiatorIp { get; set; }
|
||||
ParrComponentsEnum? IHistoryInitiator.InitiatorParrComponentId { get; set; }
|
||||
string? IHistoryInitiator.InitiatorComment { get; set; }
|
||||
}
|
||||
}
|
||||
4026
PARR.DAL/Migrations/20251201045923_tblTemplateStatusType.Designer.cs
generated
Normal file
4026
PARR.DAL/Migrations/20251201045923_tblTemplateStatusType.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
101
PARR.DAL/Migrations/20251201045923_tblTemplateStatusType.cs
Normal file
101
PARR.DAL/Migrations/20251201045923_tblTemplateStatusType.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class tblTemplateStatusType : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsUnused",
|
||||
table: "Templates");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "StatusTypeId",
|
||||
table: "Templates",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "StatusTypeId",
|
||||
table: "TemplateHistories",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TemplateStatusTypes",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Description = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TemplateStatusTypes", x => x.Id);
|
||||
},
|
||||
comment: "Таблица описания критериев выборки аттрибутов ЭК");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "TemplateStatusTypes",
|
||||
columns: new[] { "Id", "Description", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 0, "В работе", "Used" },
|
||||
{ 1, "Не используется", "Unused" },
|
||||
{ 2, "Обновляется", "Updating" }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Templates_StatusTypeId",
|
||||
table: "Templates",
|
||||
column: "StatusTypeId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Templates_TemplateStatusTypes_StatusTypeId",
|
||||
table: "Templates",
|
||||
column: "StatusTypeId",
|
||||
principalTable: "TemplateStatusTypes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Templates_TemplateStatusTypes_StatusTypeId",
|
||||
table: "Templates");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TemplateStatusTypes");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Templates_StatusTypeId",
|
||||
table: "Templates");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "StatusTypeId",
|
||||
table: "Templates");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "StatusTypeId",
|
||||
table: "TemplateHistories");
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsUnused",
|
||||
table: "Templates",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2693,9 +2693,6 @@ namespace PARR.DAL.Migrations
|
||||
b.Property<bool>("IsActiveTemplate")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsUnused")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<Guid>("JobId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
@@ -2712,6 +2709,9 @@ namespace PARR.DAL.Migrations
|
||||
b.Property<string>("ScheduleEsppId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("StatusTypeId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid>("UnitId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
@@ -2719,6 +2719,8 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
b.HasIndex("JobId");
|
||||
|
||||
b.HasIndex("StatusTypeId");
|
||||
|
||||
b.HasIndex("UnitId");
|
||||
|
||||
b.HasIndex("Name", "Index")
|
||||
@@ -2767,6 +2769,9 @@ namespace PARR.DAL.Migrations
|
||||
b.Property<Guid>("ParentId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("StatusTypeId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ParentId");
|
||||
@@ -2774,6 +2779,47 @@ namespace PARR.DAL.Migrations
|
||||
b.ToTable("TemplateHistories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.TemplateStatusType", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("TemplateStatusTypes", t =>
|
||||
{
|
||||
t.HasComment("Таблица описания критериев выборки аттрибутов ЭК");
|
||||
});
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 0,
|
||||
Description = "В работе",
|
||||
Name = "Used"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Description = "Не используется",
|
||||
Name = "Unused"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Description = "Обновляется",
|
||||
Name = "Updating"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Tnk", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@@ -3552,6 +3598,12 @@ namespace PARR.DAL.Migrations
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.TemplateStatusType", "StatusType")
|
||||
.WithMany("Templates")
|
||||
.HasForeignKey("StatusTypeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.Unit.Unit", "Unit")
|
||||
.WithMany("Templates")
|
||||
.HasForeignKey("UnitId")
|
||||
@@ -3560,6 +3612,8 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
b.Navigation("Job");
|
||||
|
||||
b.Navigation("StatusType");
|
||||
|
||||
b.Navigation("Unit");
|
||||
});
|
||||
|
||||
@@ -3904,6 +3958,11 @@ namespace PARR.DAL.Migrations
|
||||
b.Navigation("UnitsInTemplate");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.TemplateStatusType", b =>
|
||||
{
|
||||
b.Navigation("Templates");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Tnk", b =>
|
||||
{
|
||||
b.Navigation("Works");
|
||||
|
||||
@@ -4,7 +4,6 @@ using PARR.Constants;
|
||||
using PARR.DAL.Models.Base;
|
||||
using PARR.DAL.Models.Base.History;
|
||||
using PARR.DAL.Models.Base.History.Base;
|
||||
using PARR.DAL.Models.Job;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
@@ -32,11 +31,6 @@ namespace PARR.DAL.Models
|
||||
|
||||
public bool IsActiveSchedule { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Шаблон не используется : перестал подходить условиям Job'а. true - не используется
|
||||
/// </summary>
|
||||
public bool IsUnused { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Номер расписания еспп
|
||||
/// </summary>
|
||||
@@ -64,6 +58,8 @@ namespace PARR.DAL.Models
|
||||
|
||||
public Guid UnitId { get; set; }
|
||||
|
||||
public TemplateStatusTypeEnum StatusTypeId { get; set; } = TemplateStatusTypeEnum.Used;
|
||||
|
||||
//public Guid HostId { get; set; }
|
||||
|
||||
#region Initiator
|
||||
@@ -96,5 +92,7 @@ namespace PARR.DAL.Models
|
||||
public ICollection<TemplateHistory> TemplateHistories { get; set; } = new HashSet<TemplateHistory>();
|
||||
|
||||
public ICollection<UnitsInTemplate> UnitsInTemplate { get; set; } = new HashSet<UnitsInTemplate>();
|
||||
|
||||
public TemplateStatusType? StatusType { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ namespace PARR.DAL.Models
|
||||
|
||||
public DateTimeOffset NextRun { get; set; }
|
||||
|
||||
public TemplateStatusTypeEnum StatusTypeId { get; set; } = TemplateStatusTypeEnum.Used;
|
||||
|
||||
|
||||
[ForeignKey(nameof(ParentId))]
|
||||
public Template? Template { get; set; }
|
||||
|
||||
21
PARR.DAL/Models/TemplateStatusType.cs
Normal file
21
PARR.DAL/Models/TemplateStatusType.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PARR.Constants;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PARR.DAL.Models
|
||||
{
|
||||
[Table("TemplateStatusTypes")]
|
||||
[Comment("Таблица описания критериев выборки аттрибутов ЭК")]
|
||||
public class TemplateStatusType
|
||||
{
|
||||
[Key]
|
||||
public TemplateStatusTypeEnum Id { get; set; }
|
||||
|
||||
public required string Name { get; set; }
|
||||
|
||||
public required string Description { get; set; }
|
||||
|
||||
public ICollection<Template> Templates { get; set; } = new HashSet<Template>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user