feat(api): Обновил логику получения задания роботом для Расписания (nextRun, lastRun))

This commit is contained in:
Mikhail Trubnikov
2023-10-17 10:53:02 +10:00
parent 0eed4315ff
commit 26bd0a9a6b
10 changed files with 3143 additions and 61 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,93 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class TblAppInWorksUpdNextLastRun : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ScheduleGenerationTime",
table: "ApplicationsInWorks");
migrationBuilder.DropColumn(
name: "ScheduleStartDate",
table: "ApplicationsInWorks");
migrationBuilder.AddColumn<string>(
name: "AgentName",
table: "ApplicationsInWorks",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "AgentScript",
table: "ApplicationsInWorks",
type: "text",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "IsAgent",
table: "ApplicationsInWorks",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<DateTimeOffset>(
name: "LastRun",
table: "ApplicationsInWorks",
type: "timestamp with time zone",
nullable: true);
migrationBuilder.AddColumn<DateTimeOffset>(
name: "NextRun",
table: "ApplicationsInWorks",
type: "timestamp with time zone",
nullable: false,
defaultValue: new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)));
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "AgentName",
table: "ApplicationsInWorks");
migrationBuilder.DropColumn(
name: "AgentScript",
table: "ApplicationsInWorks");
migrationBuilder.DropColumn(
name: "IsAgent",
table: "ApplicationsInWorks");
migrationBuilder.DropColumn(
name: "LastRun",
table: "ApplicationsInWorks");
migrationBuilder.DropColumn(
name: "NextRun",
table: "ApplicationsInWorks");
migrationBuilder.AddColumn<TimeSpan>(
name: "ScheduleGenerationTime",
table: "ApplicationsInWorks",
type: "interval",
nullable: false,
defaultValue: new TimeSpan(0, 0, 0, 0, 0));
migrationBuilder.AddColumn<DateOnly>(
name: "ScheduleStartDate",
table: "ApplicationsInWorks",
type: "date",
nullable: false,
defaultValue: new DateOnly(1, 1, 1));
}
}
}

View File

@@ -392,7 +392,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("ApplicationTypeId");
b.ToTable("Applications", (string)null);
b.ToTable("Applications");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b =>
@@ -419,7 +419,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("HostId");
b.ToTable("ApplicationsInHost", (string)null);
b.ToTable("ApplicationsInHost");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
@@ -443,7 +443,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Id");
b.ToTable("ApplicationTypes", (string)null);
b.ToTable("ApplicationTypes");
b.HasData(
new
@@ -475,6 +475,12 @@ namespace PARR.DAL.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("AgentName")
.HasColumnType("text");
b.Property<string>("AgentScript")
.HasColumnType("text");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
@@ -488,11 +494,14 @@ namespace PARR.DAL.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<TimeSpan>("ScheduleGenerationTime")
.HasColumnType("interval");
b.Property<bool>("IsAgent")
.HasColumnType("boolean");
b.Property<DateOnly>("ScheduleStartDate")
.HasColumnType("date");
b.Property<DateTimeOffset?>("LastRun")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset>("NextRun")
.HasColumnType("timestamp with time zone");
b.Property<string>("ShortDescription")
.IsRequired()
@@ -516,7 +525,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("WorkId", "ApplicationId")
.IsUnique();
b.ToTable("ApplicationsInWorks", (string)null);
b.ToTable("ApplicationsInWorks");
});
modelBuilder.Entity("PARR.DAL.Models.EkStatus", b =>
@@ -533,7 +542,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Code");
b.ToTable("EkStatuses", (string)null);
b.ToTable("EkStatuses");
b.HasData(
new
@@ -596,7 +605,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Id");
b.ToTable("EsppSchTypes", (string)null);
b.ToTable("EsppSchTypes");
b.HasData(
new
@@ -665,7 +674,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("TypeScheduleId", "TypeId")
.IsUnique();
b.ToTable("EsppSchTypeConfigs", (string)null);
b.ToTable("EsppSchTypeConfigs");
b.HasData(
new
@@ -768,7 +777,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Id");
b.ToTable("EsppSchTypeSchedules", (string)null);
b.ToTable("EsppSchTypeSchedules");
b.HasData(
new
@@ -829,7 +838,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("TypeId");
b.ToTable("EsppSchTypeValues", (string)null);
b.ToTable("EsppSchTypeValues");
b.HasData(
new
@@ -1432,7 +1441,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("TypeValueId");
b.ToTable("EsppSchValues", (string)null);
b.ToTable("EsppSchValues");
});
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
@@ -1470,7 +1479,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("ResponseAreaCode");
b.ToTable("Hosts", (string)null);
b.ToTable("Hosts");
});
modelBuilder.Entity("PARR.DAL.Models.Process", b =>
@@ -1494,7 +1503,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Id");
b.ToTable("Processes", (string)null);
b.ToTable("Processes");
});
modelBuilder.Entity("PARR.DAL.Models.ResponseArea", b =>
@@ -1511,7 +1520,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Code");
b.ToTable("ResponseAreas", (string)null);
b.ToTable("ResponseAreas");
b.HasData(
new
@@ -1622,7 +1631,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("Name")
.IsUnique();
b.ToTable("Robots", (string)null);
b.ToTable("Robots");
b.HasData(
new
@@ -1677,7 +1686,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("TemplateId", "RobotCode")
.IsUnique();
b.ToTable("RobotConfigurations", (string)null);
b.ToTable("RobotConfigurations");
});
modelBuilder.Entity("PARR.DAL.Models.RobotHistory", b =>
@@ -1712,7 +1721,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("TaskStatusCode");
b.ToTable("RobotHistories", (string)null);
b.ToTable("RobotHistories");
});
modelBuilder.Entity("PARR.DAL.Models.RobotHistoryLevel", b =>
@@ -1733,7 +1742,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Level");
b.ToTable("RobotHistoryLevels", (string)null);
b.ToTable("RobotHistoryLevels");
b.HasData(
new
@@ -1780,7 +1789,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Code");
b.ToTable("RobotStatuses", (string)null);
b.ToTable("RobotStatuses");
b.HasData(
new
@@ -1824,7 +1833,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Name");
b.ToTable("Settings", (string)null);
b.ToTable("Settings");
b.HasData(
new
@@ -1909,7 +1918,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("ProcessId");
b.ToTable("Subprocesses", (string)null);
b.ToTable("Subprocesses");
});
modelBuilder.Entity("PARR.DAL.Models.TaskStatus", b =>
@@ -1930,7 +1939,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Code");
b.ToTable("TaskStatuses", (string)null);
b.ToTable("TaskStatuses");
b.HasData(
new
@@ -1993,7 +2002,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("Name")
.IsUnique();
b.ToTable("Templates", (string)null);
b.ToTable("Templates");
});
modelBuilder.Entity("PARR.DAL.Models.Tnk", b =>
@@ -2022,7 +2031,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("SubprocessId");
b.ToTable("Tnks", (string)null);
b.ToTable("Tnks");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
@@ -2048,7 +2057,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("ApplicationTypeId");
b.ToTable("V1_Applications", (string)null);
b.ToTable("V1_Applications");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationInHost", b =>
@@ -2080,7 +2089,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("V1_ApplicationId");
b.ToTable("V1_ApplicationsInHost", (string)null);
b.ToTable("V1_ApplicationsInHost");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationType", b =>
@@ -2109,7 +2118,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("V1_ApplicationTypeId");
b.ToTable("V1_ApplicationTypes", (string)null);
b.ToTable("V1_ApplicationTypes");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Host", b =>
@@ -2148,7 +2157,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Id");
b.ToTable("V1_Hosts", (string)null);
b.ToTable("V1_Hosts");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b =>
@@ -2202,7 +2211,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("JobTypeId");
b.ToTable("V1_Jobs", (string)null);
b.ToTable("V1_Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobCategory", b =>
@@ -2226,7 +2235,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Id");
b.ToTable("V1_JobCategorys", (string)null);
b.ToTable("V1_JobCategorys");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobJournal", b =>
@@ -2270,7 +2279,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("JobStatusId");
b.ToTable("V1_JobJournals", (string)null);
b.ToTable("V1_JobJournals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobMode", b =>
@@ -2291,7 +2300,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Id");
b.ToTable("V1_JobModes", (string)null);
b.ToTable("V1_JobModes");
b.HasData(
new
@@ -2329,7 +2338,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Id");
b.ToTable("V1_JobStatuses", (string)null);
b.ToTable("V1_JobStatuses");
b.HasData(
new
@@ -2369,7 +2378,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Id");
b.ToTable("V1_JobTypes", (string)null);
b.ToTable("V1_JobTypes");
});
modelBuilder.Entity("PARR.DAL.Models.Work", b =>
@@ -2398,7 +2407,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("TnkId");
b.ToTable("Works", (string)null);
b.ToTable("Works");
});
modelBuilder.Entity("PARR.DAL.Models.Application", b =>