API. Расписание для хоста в общем формате
This commit is contained in:
@@ -7,14 +7,10 @@ using PARR.API.Contracts.V1.Responses;
|
||||
using PARR.API.Contracts.V1.Responses.Base;
|
||||
using PARR.API.Controllers.V1.Base;
|
||||
using PARR.API.Extensions;
|
||||
using PARR.API.MappingProfiles;
|
||||
using PARR.API.Services.Interfaces;
|
||||
using PARR.DAL.Contracts;
|
||||
using PARR.DAL.DomainModels;
|
||||
using PARR.DAL.Models;
|
||||
using PARR.DAL.Services.Interfaces;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
|
||||
using static PARR.API.Contracts.V1.ApiRoutes;
|
||||
|
||||
namespace PARR.API.Controllers.V1
|
||||
{
|
||||
@@ -79,7 +75,7 @@ namespace PARR.API.Controllers.V1
|
||||
var d2 = DateTimeOffset.Now.Date;
|
||||
|
||||
if (d1.Date == d2) { }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -223,7 +219,7 @@ namespace PARR.API.Controllers.V1
|
||||
{
|
||||
// отнимаем пока не наступили прошлые стуки
|
||||
var min = startAtMinutes;
|
||||
while (min > 0)
|
||||
while (min >= 0)
|
||||
{
|
||||
//var jobToAdded = new Job { StartAt = queryDate.StartOfDay().AddMinutes(min) };
|
||||
//todo: check
|
||||
@@ -234,7 +230,8 @@ namespace PARR.API.Controllers.V1
|
||||
}
|
||||
|
||||
// прибавляем пока не наступят след сутки
|
||||
while (min <= allDayMinutes)
|
||||
min = startAtMinutes + job.Frequency;
|
||||
while (min < allDayMinutes)
|
||||
{
|
||||
//TODO: check
|
||||
//var jobToAdded = new Job { StartAt = queryDate.StartOfDay().AddMinutes(min) };
|
||||
@@ -249,7 +246,7 @@ namespace PARR.API.Controllers.V1
|
||||
// = queryDate
|
||||
// прибавляем пока не наступят след сутки
|
||||
var min = startAtMinutes;
|
||||
while (min <= allDayMinutes)
|
||||
while (min < allDayMinutes)
|
||||
{
|
||||
//TODO
|
||||
//var jobToAdded = new Job { StartAt = queryDate.StartOfDay().AddMinutes(min) };
|
||||
|
||||
@@ -1,512 +0,0 @@
|
||||
// <auto-generated />
|
||||
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("20230619021829_SchedulerClmnsToJob")]
|
||||
partial class SchedulerClmnsToJob
|
||||
{
|
||||
/// <inheritdoc />
|
||||
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.Application", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("ApplicationId")
|
||||
.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("ApplicationId");
|
||||
|
||||
b.HasIndex("ApplicationTypeId");
|
||||
|
||||
b.ToTable("Applications");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.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.HasKey("Id");
|
||||
|
||||
b.HasIndex("ApplicationId");
|
||||
|
||||
b.HasIndex("HostId");
|
||||
|
||||
b.ToTable("ApplicationsInHosts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.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.HasKey("Id");
|
||||
|
||||
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<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("Hosts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.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("Jobs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.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("JobCategories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.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<string>("DateOper")
|
||||
.HasColumnType("text");
|
||||
|
||||
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("JobJournals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.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("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.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("JobStatuses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.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("JobTypes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Application", null)
|
||||
.WithMany("Applications")
|
||||
.HasForeignKey("ApplicationId");
|
||||
|
||||
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.Job", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Application", "Application")
|
||||
.WithMany()
|
||||
.HasForeignKey("ApplicationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.JobCategory", "JobCategorye")
|
||||
.WithMany("Jobs")
|
||||
.HasForeignKey("JobCategoryId");
|
||||
|
||||
b.HasOne("PARR.DAL.Models.JobMode", "JobMode")
|
||||
.WithMany("Jobs")
|
||||
.HasForeignKey("JobModeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.JobType", "JobType")
|
||||
.WithMany("Jobs")
|
||||
.HasForeignKey("JobTypeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Application");
|
||||
|
||||
b.Navigation("JobCategorye");
|
||||
|
||||
b.Navigation("JobMode");
|
||||
|
||||
b.Navigation("JobType");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobJournal", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Host", "Host")
|
||||
.WithMany("JobJournals")
|
||||
.HasForeignKey("HostId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.Job", "Job")
|
||||
.WithMany("Journals")
|
||||
.HasForeignKey("JobId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.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("Applications");
|
||||
|
||||
b.Navigation("ApplicationsInHosts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
|
||||
{
|
||||
b.Navigation("ApplicationsInHosts");
|
||||
|
||||
b.Navigation("JobJournals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Job", b =>
|
||||
{
|
||||
b.Navigation("Journals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobCategory", b =>
|
||||
{
|
||||
b.Navigation("Jobs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobMode", b =>
|
||||
{
|
||||
b.Navigation("Jobs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobStatus", b =>
|
||||
{
|
||||
b.Navigation("Journals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobType", b =>
|
||||
{
|
||||
b.Navigation("Jobs");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class SchedulerClmnsToJob : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Schedulers");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Frequency",
|
||||
table: "Jobs",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsEnabled",
|
||||
table: "Jobs",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<DateTimeOffset>(
|
||||
name: "StartAt",
|
||||
table: "Jobs",
|
||||
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: "Frequency",
|
||||
table: "Jobs");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsEnabled",
|
||||
table: "Jobs");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "StartAt",
|
||||
table: "Jobs");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Schedulers",
|
||||
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),
|
||||
Frequency = table.Column<int>(type: "integer", nullable: false),
|
||||
IsEnabled = table.Column<bool>(type: "boolean", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: true),
|
||||
StartAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Schedulers", x => x.Id);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
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 TblStatus : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.InsertData(
|
||||
table: "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" }
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DeleteData(
|
||||
table: "JobStatuses",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("7b945eb6-d885-4570-aff5-8866f1f75ff2"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "JobStatuses",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("edef6dc3-adad-4c77-8ad1-63bb9052355a"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,8 @@ using PARR.DAL.Context;
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20230620022903_TblStatus")]
|
||||
partial class TblStatus
|
||||
[Migration("20230621014955_DbV5")]
|
||||
partial class DbV5
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@@ -31,9 +31,6 @@ namespace PARR.DAL.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("ApplicationId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("ApplicationTypeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
@@ -49,8 +46,6 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ApplicationId");
|
||||
|
||||
b.HasIndex("ApplicationTypeId");
|
||||
|
||||
b.ToTable("Applications");
|
||||
@@ -89,6 +84,9 @@ namespace PARR.DAL.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("ApplicationTypeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
@@ -104,6 +102,8 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ApplicationTypeId");
|
||||
|
||||
b.ToTable("ApplicationTypes");
|
||||
|
||||
b.HasData(
|
||||
@@ -259,8 +259,8 @@ namespace PARR.DAL.Migrations
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("DateOper")
|
||||
.HasColumnType("text");
|
||||
b.Property<DateTimeOffset>("DateOper")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("HostId")
|
||||
.HasColumnType("uuid");
|
||||
@@ -392,10 +392,6 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Application", null)
|
||||
.WithMany("Applications")
|
||||
.HasForeignKey("ApplicationId");
|
||||
|
||||
b.HasOne("PARR.DAL.Models.ApplicationType", "ApplicationType")
|
||||
.WithMany()
|
||||
.HasForeignKey("ApplicationTypeId")
|
||||
@@ -424,6 +420,13 @@ namespace PARR.DAL.Migrations
|
||||
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.Job", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Application", "Application")
|
||||
@@ -486,11 +489,14 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
|
||||
{
|
||||
b.Navigation("Applications");
|
||||
|
||||
b.Navigation("ApplicationsInHosts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
|
||||
{
|
||||
b.Navigation("ApplicationTypes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
|
||||
{
|
||||
b.Navigation("ApplicationsInHosts");
|
||||
@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class DbV2 : Migration
|
||||
public partial class DbV5 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
@@ -21,11 +21,17 @@ namespace PARR.DAL.Migrations
|
||||
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),
|
||||
Description = table.Column<string>(type: "text", nullable: true)
|
||||
Description = table.Column<string>(type: "text", nullable: true),
|
||||
ApplicationTypeId = table.Column<Guid>(type: "uuid", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ApplicationTypes", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ApplicationTypes_ApplicationTypes_ApplicationTypeId",
|
||||
column: x => x.ApplicationTypeId,
|
||||
principalTable: "ApplicationTypes",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
@@ -107,23 +113,6 @@ namespace PARR.DAL.Migrations
|
||||
table.PrimaryKey("PK_JobTypes", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Schedulers",
|
||||
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: true),
|
||||
Frequency = table.Column<int>(type: "integer", nullable: false),
|
||||
StartAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
IsEnabled = table.Column<bool>(type: "boolean", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Schedulers", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Applications",
|
||||
columns: table => new
|
||||
@@ -132,8 +121,7 @@ namespace PARR.DAL.Migrations
|
||||
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),
|
||||
ApplicationTypeId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ApplicationId = table.Column<Guid>(type: "uuid", nullable: true)
|
||||
ApplicationTypeId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
@@ -144,11 +132,6 @@ namespace PARR.DAL.Migrations
|
||||
principalTable: "ApplicationTypes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Applications_Applications_ApplicationId",
|
||||
column: x => x.ApplicationId,
|
||||
principalTable: "Applications",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
@@ -190,7 +173,10 @@ namespace PARR.DAL.Migrations
|
||||
JobModeId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
JobCategoryId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
JobTypeId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ApplicationId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
ApplicationId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Frequency = table.Column<int>(type: "integer", nullable: false),
|
||||
StartAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
IsEnabled = table.Column<bool>(type: "boolean", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
@@ -227,7 +213,7 @@ namespace PARR.DAL.Migrations
|
||||
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),
|
||||
DateOper = table.Column<string>(type: "text", nullable: true),
|
||||
DateOper = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
Other = table.Column<string>(type: "text", nullable: true),
|
||||
TimeOut = table.Column<int>(type: "integer", nullable: true),
|
||||
Info = table.Column<string>(type: "text", nullable: true),
|
||||
@@ -260,12 +246,12 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "ApplicationTypes",
|
||||
columns: new[] { "Id", "DateCreated", "DateModified", "Description", "Name" },
|
||||
columns: new[] { "Id", "ApplicationTypeId", "DateCreated", "DateModified", "Description", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле СП xml АИХ ИТ", "APP" },
|
||||
{ new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле ОС xml АИХ ИТ", "OS" },
|
||||
{ new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле СУБД xml АИХ ИТ", "DB" }
|
||||
{ new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"), null, new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле СП xml АИХ ИТ", "APP" },
|
||||
{ new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"), null, new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле ОС xml АИХ ИТ", "OS" },
|
||||
{ new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"), null, new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле СУБД xml АИХ ИТ", "DB" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
@@ -277,10 +263,14 @@ namespace PARR.DAL.Migrations
|
||||
{ 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.CreateIndex(
|
||||
name: "IX_Applications_ApplicationId",
|
||||
table: "Applications",
|
||||
column: "ApplicationId");
|
||||
migrationBuilder.InsertData(
|
||||
table: "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_Applications_ApplicationTypeId",
|
||||
@@ -297,6 +287,11 @@ namespace PARR.DAL.Migrations
|
||||
table: "ApplicationsInHosts",
|
||||
column: "HostId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ApplicationTypes_ApplicationTypeId",
|
||||
table: "ApplicationTypes",
|
||||
column: "ApplicationTypeId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_JobJournals_HostId",
|
||||
table: "JobJournals",
|
||||
@@ -342,9 +337,6 @@ namespace PARR.DAL.Migrations
|
||||
migrationBuilder.DropTable(
|
||||
name: "JobJournals");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Schedulers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Hosts");
|
||||
|
||||
@@ -12,8 +12,8 @@ using PARR.DAL.Context;
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20230616045916_DbV2")]
|
||||
partial class DbV2
|
||||
[Migration("20230621015625_DbV5.1")]
|
||||
partial class DbV51
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@@ -31,9 +31,6 @@ namespace PARR.DAL.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("ApplicationId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("ApplicationTypeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
@@ -49,8 +46,6 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ApplicationId");
|
||||
|
||||
b.HasIndex("ApplicationTypeId");
|
||||
|
||||
b.ToTable("Applications");
|
||||
@@ -89,6 +84,9 @@ namespace PARR.DAL.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("ApplicationTypeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
@@ -104,6 +102,8 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ApplicationTypeId");
|
||||
|
||||
b.ToTable("ApplicationTypes");
|
||||
|
||||
b.HasData(
|
||||
@@ -184,13 +184,19 @@ namespace PARR.DAL.Migrations
|
||||
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")
|
||||
b.Property<Guid?>("JobTypeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Name")
|
||||
@@ -201,6 +207,9 @@ namespace PARR.DAL.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("StartAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ApplicationId");
|
||||
@@ -250,8 +259,8 @@ namespace PARR.DAL.Migrations
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("DateOper")
|
||||
.HasColumnType("text");
|
||||
b.Property<DateTimeOffset>("DateOper")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("HostId")
|
||||
.HasColumnType("uuid");
|
||||
@@ -339,6 +348,22 @@ namespace PARR.DAL.Migrations
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("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.JobType", b =>
|
||||
@@ -365,41 +390,8 @@ namespace PARR.DAL.Migrations
|
||||
b.ToTable("JobTypes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Scheduler", 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<int>("Frequency")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("IsEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("StartAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Schedulers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Application", null)
|
||||
.WithMany("Applications")
|
||||
.HasForeignKey("ApplicationId");
|
||||
|
||||
b.HasOne("PARR.DAL.Models.ApplicationType", "ApplicationType")
|
||||
.WithMany()
|
||||
.HasForeignKey("ApplicationTypeId")
|
||||
@@ -428,6 +420,13 @@ namespace PARR.DAL.Migrations
|
||||
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.Job", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Application", "Application")
|
||||
@@ -448,9 +447,7 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
b.HasOne("PARR.DAL.Models.JobType", "JobType")
|
||||
.WithMany("Jobs")
|
||||
.HasForeignKey("JobTypeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
.HasForeignKey("JobTypeId");
|
||||
|
||||
b.Navigation("Application");
|
||||
|
||||
@@ -490,11 +487,14 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
|
||||
{
|
||||
b.Navigation("Applications");
|
||||
|
||||
b.Navigation("ApplicationsInHosts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
|
||||
{
|
||||
b.Navigation("ApplicationTypes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
|
||||
{
|
||||
b.Navigation("ApplicationsInHosts");
|
||||
60
PARR.DAL/Migrations/20230621015625_DbV5.1.cs
Normal file
60
PARR.DAL/Migrations/20230621015625_DbV5.1.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class DbV51 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Jobs_JobTypes_JobTypeId",
|
||||
table: "Jobs");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "JobTypeId",
|
||||
table: "Jobs",
|
||||
type: "uuid",
|
||||
nullable: true,
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Jobs_JobTypes_JobTypeId",
|
||||
table: "Jobs",
|
||||
column: "JobTypeId",
|
||||
principalTable: "JobTypes",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Jobs_JobTypes_JobTypeId",
|
||||
table: "Jobs");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "JobTypeId",
|
||||
table: "Jobs",
|
||||
type: "uuid",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Jobs_JobTypes_JobTypeId",
|
||||
table: "Jobs",
|
||||
column: "JobTypeId",
|
||||
principalTable: "JobTypes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,9 +28,6 @@ namespace PARR.DAL.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("ApplicationId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("ApplicationTypeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
@@ -46,8 +43,6 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ApplicationId");
|
||||
|
||||
b.HasIndex("ApplicationTypeId");
|
||||
|
||||
b.ToTable("Applications");
|
||||
@@ -86,6 +81,9 @@ namespace PARR.DAL.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("ApplicationTypeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
@@ -101,6 +99,8 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ApplicationTypeId");
|
||||
|
||||
b.ToTable("ApplicationTypes");
|
||||
|
||||
b.HasData(
|
||||
@@ -193,7 +193,7 @@ namespace PARR.DAL.Migrations
|
||||
b.Property<Guid>("JobModeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("JobTypeId")
|
||||
b.Property<Guid?>("JobTypeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Name")
|
||||
@@ -256,8 +256,8 @@ namespace PARR.DAL.Migrations
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("DateOper")
|
||||
.HasColumnType("text");
|
||||
b.Property<DateTimeOffset>("DateOper")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("HostId")
|
||||
.HasColumnType("uuid");
|
||||
@@ -389,10 +389,6 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Application", null)
|
||||
.WithMany("Applications")
|
||||
.HasForeignKey("ApplicationId");
|
||||
|
||||
b.HasOne("PARR.DAL.Models.ApplicationType", "ApplicationType")
|
||||
.WithMany()
|
||||
.HasForeignKey("ApplicationTypeId")
|
||||
@@ -421,6 +417,13 @@ namespace PARR.DAL.Migrations
|
||||
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.Job", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Application", "Application")
|
||||
@@ -441,9 +444,7 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
b.HasOne("PARR.DAL.Models.JobType", "JobType")
|
||||
.WithMany("Jobs")
|
||||
.HasForeignKey("JobTypeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
.HasForeignKey("JobTypeId");
|
||||
|
||||
b.Navigation("Application");
|
||||
|
||||
@@ -483,11 +484,14 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
|
||||
{
|
||||
b.Navigation("Applications");
|
||||
|
||||
b.Navigation("ApplicationsInHosts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
|
||||
{
|
||||
b.Navigation("ApplicationTypes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
|
||||
{
|
||||
b.Navigation("ApplicationsInHosts");
|
||||
|
||||
@@ -19,6 +19,6 @@ namespace PARR.DAL.Models
|
||||
|
||||
|
||||
public ICollection<ApplicationInHost> ApplicationsInHosts { get; set; } = new HashSet<ApplicationInHost>();
|
||||
public ICollection<Application> Applications { get;set; } = new HashSet<Application>();
|
||||
//public ICollection<Application> Applications { get;set; } = new HashSet<Application>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,5 +11,8 @@ namespace PARR.DAL.Models
|
||||
public DateTimeOffset? DateModified { get; set; }
|
||||
public required string Name { get; set; }
|
||||
public string? Description { get; set; }
|
||||
|
||||
|
||||
public ICollection<ApplicationType> ApplicationTypes { get; set; } = new HashSet<ApplicationType>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace PARR.DAL.Models
|
||||
public Guid? JobCategoryId { get; set; }
|
||||
[ForeignKey(nameof(JobCategoryId))]
|
||||
public JobCategory? JobCategorye { get; set; }
|
||||
|
||||
public Guid JobTypeId { get; set; }
|
||||
|
||||
public Guid? JobTypeId { get; set; }
|
||||
[ForeignKey(nameof(JobTypeId))]
|
||||
public JobType? JobType { get; set; }
|
||||
|
||||
|
||||
@@ -24,17 +24,17 @@ namespace PARR.DAL.Services.Implementations
|
||||
|
||||
public async Task<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.AddTicks(0-j.DateOper.UtcTicks) <= n))/*date.StartOfDay()*/// && j.DateOper < date.EndOfDay()))
|
||||
.OrderBy(t => t.DateOper)
|
||||
.LastOrDefaultAsync();
|
||||
|
||||
//var n=DateTimeOffset.UtcNow;
|
||||
//var opers = await EntitySet
|
||||
// .Where(j => j.JobId == jobId && j.HostId == hostId && j.DateOper.DateTime.Date == date.DateTime.Date)
|
||||
// .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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user