feat(api): Логика смены статусов для заданий робота. RobotTaskController
This commit is contained in:
2040
PARR.DAL/Migrations/20231005045908_TblUpdTemplates.Designer.cs
generated
Normal file
2040
PARR.DAL/Migrations/20231005045908_TblUpdTemplates.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
268
PARR.DAL/Migrations/20231005045908_TblUpdTemplates.cs
Normal file
268
PARR.DAL/Migrations/20231005045908_TblUpdTemplates.cs
Normal file
@@ -0,0 +1,268 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class TblUpdTemplates : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_RobotConfigurations_StatusTemplates_TaskStatusCode",
|
||||
table: "RobotConfigurations");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_RobotHistories_StatusTemplates_TaskStatusCode",
|
||||
table: "RobotHistories");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_RobotTemplateHistories_StatusTemplates_TemplateStatusCode",
|
||||
table: "RobotTemplateHistories");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Templates_RobotStatuses_RobotStatusCode",
|
||||
table: "Templates");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Templates_StatusTemplates_StatusCode",
|
||||
table: "Templates");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "StatusTemplates");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "IsActive",
|
||||
table: "Templates",
|
||||
newName: "IsActiveTemplate");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "StatusCode",
|
||||
table: "Templates",
|
||||
type: "integer",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "integer");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "RobotStatusCode",
|
||||
table: "Templates",
|
||||
type: "integer",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "integer");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "RobotAttemptsNumber",
|
||||
table: "Templates",
|
||||
type: "integer",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "integer");
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsActiveSchedule",
|
||||
table: "Templates",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TaskStatuses",
|
||||
columns: table => new
|
||||
{
|
||||
Code = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Description = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TaskStatuses", x => x.Code);
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "TaskStatuses",
|
||||
columns: new[] { "Code", "Description", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 10, "Задание на создание объекта в ЕСПП", "Creating" },
|
||||
{ 20, "Задание на обновление объекта в ЕСПП", "Updating" },
|
||||
{ 30, "Объект в ЕСПП соответствует объекту в ПАРР", "Ok" }
|
||||
});
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_RobotConfigurations_TaskStatuses_TaskStatusCode",
|
||||
table: "RobotConfigurations",
|
||||
column: "TaskStatusCode",
|
||||
principalTable: "TaskStatuses",
|
||||
principalColumn: "Code",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_RobotHistories_TaskStatuses_TaskStatusCode",
|
||||
table: "RobotHistories",
|
||||
column: "TaskStatusCode",
|
||||
principalTable: "TaskStatuses",
|
||||
principalColumn: "Code",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_RobotTemplateHistories_TaskStatuses_TemplateStatusCode",
|
||||
table: "RobotTemplateHistories",
|
||||
column: "TemplateStatusCode",
|
||||
principalTable: "TaskStatuses",
|
||||
principalColumn: "Code",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Templates_RobotStatuses_RobotStatusCode",
|
||||
table: "Templates",
|
||||
column: "RobotStatusCode",
|
||||
principalTable: "RobotStatuses",
|
||||
principalColumn: "Code");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Templates_TaskStatuses_StatusCode",
|
||||
table: "Templates",
|
||||
column: "StatusCode",
|
||||
principalTable: "TaskStatuses",
|
||||
principalColumn: "Code");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_RobotConfigurations_TaskStatuses_TaskStatusCode",
|
||||
table: "RobotConfigurations");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_RobotHistories_TaskStatuses_TaskStatusCode",
|
||||
table: "RobotHistories");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_RobotTemplateHistories_TaskStatuses_TemplateStatusCode",
|
||||
table: "RobotTemplateHistories");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Templates_RobotStatuses_RobotStatusCode",
|
||||
table: "Templates");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Templates_TaskStatuses_StatusCode",
|
||||
table: "Templates");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TaskStatuses");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsActiveSchedule",
|
||||
table: "Templates");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "IsActiveTemplate",
|
||||
table: "Templates",
|
||||
newName: "IsActive");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "StatusCode",
|
||||
table: "Templates",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "integer",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "RobotStatusCode",
|
||||
table: "Templates",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "integer",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "RobotAttemptsNumber",
|
||||
table: "Templates",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "integer",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "StatusTemplates",
|
||||
columns: table => new
|
||||
{
|
||||
Code = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Description = table.Column<string>(type: "text", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_StatusTemplates", x => x.Code);
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "StatusTemplates",
|
||||
columns: new[] { "Code", "Description", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 10, "Создали шаблон в ПАРР", "Creating" },
|
||||
{ 20, "Выявлено несоответствие. Требуется привлечение робота", "Updating" },
|
||||
{ 30, "Нормальное состояние шаблона в ЕСПП и ПАРР. Шаблон в ПАРР соответствует шаблону в ЕСПП", "Ok" }
|
||||
});
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_RobotConfigurations_StatusTemplates_TaskStatusCode",
|
||||
table: "RobotConfigurations",
|
||||
column: "TaskStatusCode",
|
||||
principalTable: "StatusTemplates",
|
||||
principalColumn: "Code",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_RobotHistories_StatusTemplates_TaskStatusCode",
|
||||
table: "RobotHistories",
|
||||
column: "TaskStatusCode",
|
||||
principalTable: "StatusTemplates",
|
||||
principalColumn: "Code",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_RobotTemplateHistories_StatusTemplates_TemplateStatusCode",
|
||||
table: "RobotTemplateHistories",
|
||||
column: "TemplateStatusCode",
|
||||
principalTable: "StatusTemplates",
|
||||
principalColumn: "Code",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Templates_RobotStatuses_RobotStatusCode",
|
||||
table: "Templates",
|
||||
column: "RobotStatusCode",
|
||||
principalTable: "RobotStatuses",
|
||||
principalColumn: "Code",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Templates_StatusTemplates_StatusCode",
|
||||
table: "Templates",
|
||||
column: "StatusCode",
|
||||
principalTable: "StatusTemplates",
|
||||
principalColumn: "Code",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1049,47 +1049,6 @@ namespace PARR.DAL.Migrations
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.StatusTask", b =>
|
||||
{
|
||||
b.Property<int>("Code")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Code"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Code");
|
||||
|
||||
b.ToTable("StatusTemplates");
|
||||
|
||||
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.Subprocess", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@@ -1119,6 +1078,47 @@ namespace PARR.DAL.Migrations
|
||||
b.ToTable("Subprocesses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.TaskStatus", b =>
|
||||
{
|
||||
b.Property<int>("Code")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Code"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("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<Guid>("Id")
|
||||
@@ -1137,23 +1137,26 @@ namespace PARR.DAL.Migrations
|
||||
b.Property<Guid>("HostId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
b.Property<bool>("IsActiveSchedule")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsActiveTemplate")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("RobotAttemptsNumber")
|
||||
b.Property<int?>("RobotAttemptsNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTimeOffset?>("RobotLastStatusUpdated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("RobotStatusCode")
|
||||
b.Property<int?>("RobotStatusCode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("StatusCode")
|
||||
b.Property<int?>("StatusCode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
@@ -1659,7 +1662,7 @@ namespace PARR.DAL.Migrations
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.StatusTask", "StatusTask")
|
||||
b.HasOne("PARR.DAL.Models.TaskStatus", "StatusTask")
|
||||
.WithMany()
|
||||
.HasForeignKey("TaskStatusCode")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
@@ -1694,7 +1697,7 @@ namespace PARR.DAL.Migrations
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.StatusTask", "StatusTask")
|
||||
b.HasOne("PARR.DAL.Models.TaskStatus", "StatusTask")
|
||||
.WithMany()
|
||||
.HasForeignKey("TaskStatusCode")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
@@ -1721,7 +1724,7 @@ namespace PARR.DAL.Migrations
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.StatusTask", "StatusTemplate")
|
||||
b.HasOne("PARR.DAL.Models.TaskStatus", "StatusTemplate")
|
||||
.WithMany("RobotTemplateHistories")
|
||||
.HasForeignKey("TemplateStatusCode")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
@@ -1761,15 +1764,11 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
b.HasOne("PARR.DAL.Models.RobotStatus", "RobotStatus")
|
||||
.WithMany("Templates")
|
||||
.HasForeignKey("RobotStatusCode")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
.HasForeignKey("RobotStatusCode");
|
||||
|
||||
b.HasOne("PARR.DAL.Models.StatusTask", "StatusTask")
|
||||
b.HasOne("PARR.DAL.Models.TaskStatus", "StatusTask")
|
||||
.WithMany("Templates")
|
||||
.HasForeignKey("StatusCode")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
.HasForeignKey("StatusCode");
|
||||
|
||||
b.Navigation("ApplicationsInWork");
|
||||
|
||||
@@ -1962,18 +1961,18 @@ namespace PARR.DAL.Migrations
|
||||
b.Navigation("Templates");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.StatusTask", b =>
|
||||
modelBuilder.Entity("PARR.DAL.Models.Subprocess", b =>
|
||||
{
|
||||
b.Navigation("Tnks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.TaskStatus", b =>
|
||||
{
|
||||
b.Navigation("RobotTemplateHistories");
|
||||
|
||||
b.Navigation("Templates");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Subprocess", b =>
|
||||
{
|
||||
b.Navigation("Tnks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Template", b =>
|
||||
{
|
||||
b.Navigation("RobotConfigurations");
|
||||
|
||||
Reference in New Issue
Block a user