diff --git a/PARR.API/Controllers/V1/JobController.cs b/PARR.API/Controllers/V1/JobController.cs
index 861ccee4..dc802abd 100644
--- a/PARR.API/Controllers/V1/JobController.cs
+++ b/PARR.API/Controllers/V1/JobController.cs
@@ -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) };
diff --git a/PARR.DAL/Migrations/20230619021829_SchedulerClmnsToJob.Designer.cs b/PARR.DAL/Migrations/20230619021829_SchedulerClmnsToJob.Designer.cs
deleted file mode 100644
index 92412ac6..00000000
--- a/PARR.DAL/Migrations/20230619021829_SchedulerClmnsToJob.Designer.cs
+++ /dev/null
@@ -1,512 +0,0 @@
-//
-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
- {
- ///
- 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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property("ApplicationId")
- .HasColumnType("uuid");
-
- b.Property("ApplicationTypeId")
- .HasColumnType("uuid");
-
- b.Property("DateCreated")
- .HasColumnType("timestamp with time zone");
-
- b.Property("DateModified")
- .HasColumnType("timestamp with time zone");
-
- b.Property("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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property("ApplicationId")
- .HasColumnType("uuid");
-
- b.Property("DateCreated")
- .HasColumnType("timestamp with time zone");
-
- b.Property("DateModified")
- .HasColumnType("timestamp with time zone");
-
- b.Property("HostId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("ApplicationId");
-
- b.HasIndex("HostId");
-
- b.ToTable("ApplicationsInHosts");
- });
-
- modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property("DateCreated")
- .HasColumnType("timestamp with time zone");
-
- b.Property("DateModified")
- .HasColumnType("timestamp with time zone");
-
- b.Property("Description")
- .HasColumnType("text");
-
- b.Property("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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property("DateCreated")
- .HasColumnType("timestamp with time zone");
-
- b.Property("DateModified")
- .HasColumnType("timestamp with time zone");
-
- b.Property("HostName")
- .HasColumnType("text");
-
- b.Property("IP")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property("LinkEK")
- .HasColumnType("text");
-
- b.Property("RegionalEK")
- .HasColumnType("text");
-
- b.Property("Responsible")
- .HasColumnType("text");
-
- b.Property("Status")
- .HasColumnType("text");
-
- b.Property("WorkGroup")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("Hosts");
- });
-
- modelBuilder.Entity("PARR.DAL.Models.Job", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property("ApplicationId")
- .HasColumnType("uuid");
-
- b.Property("DateCreated")
- .HasColumnType("timestamp with time zone");
-
- b.Property("DateModified")
- .HasColumnType("timestamp with time zone");
-
- b.Property("Frequency")
- .HasColumnType("integer");
-
- b.Property("IsEnabled")
- .HasColumnType("boolean");
-
- b.Property("JobCategoryId")
- .HasColumnType("uuid");
-
- b.Property("JobModeId")
- .HasColumnType("uuid");
-
- b.Property("JobTypeId")
- .HasColumnType("uuid");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property("ScriptName")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property("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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property("DateCreated")
- .HasColumnType("timestamp with time zone");
-
- b.Property("DateModified")
- .HasColumnType("timestamp with time zone");
-
- b.Property("Description")
- .HasColumnType("text");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("JobCategories");
- });
-
- modelBuilder.Entity("PARR.DAL.Models.JobJournal", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property("DateCreated")
- .HasColumnType("timestamp with time zone");
-
- b.Property("DateModified")
- .HasColumnType("timestamp with time zone");
-
- b.Property("DateOper")
- .HasColumnType("text");
-
- b.Property("HostId")
- .HasColumnType("uuid");
-
- b.Property("Info")
- .HasColumnType("text");
-
- b.Property("JobId")
- .HasColumnType("uuid");
-
- b.Property("JobStatusId")
- .HasColumnType("uuid");
-
- b.Property("Other")
- .HasColumnType("text");
-
- b.Property("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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property("DateCreated")
- .HasColumnType("timestamp with time zone");
-
- b.Property("DateModified")
- .HasColumnType("timestamp with time zone");
-
- b.Property("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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property("DateCreated")
- .HasColumnType("timestamp with time zone");
-
- b.Property("DateModified")
- .HasColumnType("timestamp with time zone");
-
- b.Property("Description")
- .HasColumnType("text");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("JobStatuses");
- });
-
- modelBuilder.Entity("PARR.DAL.Models.JobType", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property("DateCreated")
- .HasColumnType("timestamp with time zone");
-
- b.Property("DateModified")
- .HasColumnType("timestamp with time zone");
-
- b.Property("Description")
- .HasColumnType("text");
-
- b.Property("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
- }
- }
-}
diff --git a/PARR.DAL/Migrations/20230619021829_SchedulerClmnsToJob.cs b/PARR.DAL/Migrations/20230619021829_SchedulerClmnsToJob.cs
deleted file mode 100644
index 95456021..00000000
--- a/PARR.DAL/Migrations/20230619021829_SchedulerClmnsToJob.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace PARR.DAL.Migrations
-{
- ///
- public partial class SchedulerClmnsToJob : Migration
- {
- ///
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "Schedulers");
-
- migrationBuilder.AddColumn(
- name: "Frequency",
- table: "Jobs",
- type: "integer",
- nullable: false,
- defaultValue: 0);
-
- migrationBuilder.AddColumn(
- name: "IsEnabled",
- table: "Jobs",
- type: "boolean",
- nullable: false,
- defaultValue: false);
-
- migrationBuilder.AddColumn(
- 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)));
- }
-
- ///
- 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(type: "uuid", nullable: false),
- DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
- DateModified = table.Column(type: "timestamp with time zone", nullable: true),
- Frequency = table.Column(type: "integer", nullable: false),
- IsEnabled = table.Column(type: "boolean", nullable: false),
- Name = table.Column(type: "text", nullable: true),
- StartAt = table.Column(type: "timestamp with time zone", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Schedulers", x => x.Id);
- });
- }
- }
-}
diff --git a/PARR.DAL/Migrations/20230620022903_TblStatus.cs b/PARR.DAL/Migrations/20230620022903_TblStatus.cs
deleted file mode 100644
index fcdfce3d..00000000
--- a/PARR.DAL/Migrations/20230620022903_TblStatus.cs
+++ /dev/null
@@ -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
-{
- ///
- public partial class TblStatus : Migration
- {
- ///
- 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" }
- });
- }
-
- ///
- 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"));
- }
- }
-}
diff --git a/PARR.DAL/Migrations/20230620022903_TblStatus.Designer.cs b/PARR.DAL/Migrations/20230621014955_DbV5.Designer.cs
similarity index 96%
rename from PARR.DAL/Migrations/20230620022903_TblStatus.Designer.cs
rename to PARR.DAL/Migrations/20230621014955_DbV5.Designer.cs
index 109a8f3e..df4f7c54 100644
--- a/PARR.DAL/Migrations/20230620022903_TblStatus.Designer.cs
+++ b/PARR.DAL/Migrations/20230621014955_DbV5.Designer.cs
@@ -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
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -31,9 +31,6 @@ namespace PARR.DAL.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
- b.Property("ApplicationId")
- .HasColumnType("uuid");
-
b.Property("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("ApplicationTypeId")
+ .HasColumnType("uuid");
+
b.Property("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("DateModified")
.HasColumnType("timestamp with time zone");
- b.Property("DateOper")
- .HasColumnType("text");
+ b.Property("DateOper")
+ .HasColumnType("timestamp with time zone");
b.Property("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");
diff --git a/PARR.DAL/Migrations/20230616045916_DbV2.cs b/PARR.DAL/Migrations/20230621014955_DbV5.cs
similarity index 90%
rename from PARR.DAL/Migrations/20230616045916_DbV2.cs
rename to PARR.DAL/Migrations/20230621014955_DbV5.cs
index cddf535e..86e26597 100644
--- a/PARR.DAL/Migrations/20230616045916_DbV2.cs
+++ b/PARR.DAL/Migrations/20230621014955_DbV5.cs
@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace PARR.DAL.Migrations
{
///
- public partial class DbV2 : Migration
+ public partial class DbV5 : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
@@ -21,11 +21,17 @@ namespace PARR.DAL.Migrations
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
Name = table.Column(type: "text", nullable: false),
- Description = table.Column(type: "text", nullable: true)
+ Description = table.Column(type: "text", nullable: true),
+ ApplicationTypeId = table.Column(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(type: "uuid", nullable: false),
- DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
- DateModified = table.Column(type: "timestamp with time zone", nullable: true),
- Name = table.Column(type: "text", nullable: true),
- Frequency = table.Column(type: "integer", nullable: false),
- StartAt = table.Column(type: "timestamp with time zone", nullable: false),
- IsEnabled = table.Column(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(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
Name = table.Column(type: "text", nullable: false),
- ApplicationTypeId = table.Column(type: "uuid", nullable: false),
- ApplicationId = table.Column(type: "uuid", nullable: true)
+ ApplicationTypeId = table.Column(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(type: "uuid", nullable: false),
JobCategoryId = table.Column(type: "uuid", nullable: true),
JobTypeId = table.Column(type: "uuid", nullable: false),
- ApplicationId = table.Column(type: "uuid", nullable: false)
+ ApplicationId = table.Column(type: "uuid", nullable: false),
+ Frequency = table.Column(type: "integer", nullable: false),
+ StartAt = table.Column(type: "timestamp with time zone", nullable: false),
+ IsEnabled = table.Column(type: "boolean", nullable: false)
},
constraints: table =>
{
@@ -227,7 +213,7 @@ namespace PARR.DAL.Migrations
Id = table.Column(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
- DateOper = table.Column(type: "text", nullable: true),
+ DateOper = table.Column(type: "timestamp with time zone", nullable: false),
Other = table.Column(type: "text", nullable: true),
TimeOut = table.Column(type: "integer", nullable: true),
Info = table.Column(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");
diff --git a/PARR.DAL/Migrations/20230616045916_DbV2.Designer.cs b/PARR.DAL/Migrations/20230621015625_DbV5.1.Designer.cs
similarity index 91%
rename from PARR.DAL/Migrations/20230616045916_DbV2.Designer.cs
rename to PARR.DAL/Migrations/20230621015625_DbV5.1.Designer.cs
index 16b19552..5d44c19a 100644
--- a/PARR.DAL/Migrations/20230616045916_DbV2.Designer.cs
+++ b/PARR.DAL/Migrations/20230621015625_DbV5.1.Designer.cs
@@ -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
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -31,9 +31,6 @@ namespace PARR.DAL.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
- b.Property("ApplicationId")
- .HasColumnType("uuid");
-
b.Property("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("ApplicationTypeId")
+ .HasColumnType("uuid");
+
b.Property("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("DateModified")
.HasColumnType("timestamp with time zone");
+ b.Property("Frequency")
+ .HasColumnType("integer");
+
+ b.Property("IsEnabled")
+ .HasColumnType("boolean");
+
b.Property("JobCategoryId")
.HasColumnType("uuid");
b.Property("JobModeId")
.HasColumnType("uuid");
- b.Property("JobTypeId")
+ b.Property("JobTypeId")
.HasColumnType("uuid");
b.Property("Name")
@@ -201,6 +207,9 @@ namespace PARR.DAL.Migrations
.IsRequired()
.HasColumnType("text");
+ b.Property("StartAt")
+ .HasColumnType("timestamp with time zone");
+
b.HasKey("Id");
b.HasIndex("ApplicationId");
@@ -250,8 +259,8 @@ namespace PARR.DAL.Migrations
b.Property("DateModified")
.HasColumnType("timestamp with time zone");
- b.Property("DateOper")
- .HasColumnType("text");
+ b.Property("DateOper")
+ .HasColumnType("timestamp with time zone");
b.Property("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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property("DateCreated")
- .HasColumnType("timestamp with time zone");
-
- b.Property("DateModified")
- .HasColumnType("timestamp with time zone");
-
- b.Property("Frequency")
- .HasColumnType("integer");
-
- b.Property("IsEnabled")
- .HasColumnType("boolean");
-
- b.Property("Name")
- .HasColumnType("text");
-
- b.Property("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");
diff --git a/PARR.DAL/Migrations/20230621015625_DbV5.1.cs b/PARR.DAL/Migrations/20230621015625_DbV5.1.cs
new file mode 100644
index 00000000..ebb2a61d
--- /dev/null
+++ b/PARR.DAL/Migrations/20230621015625_DbV5.1.cs
@@ -0,0 +1,60 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace PARR.DAL.Migrations
+{
+ ///
+ public partial class DbV51 : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_Jobs_JobTypes_JobTypeId",
+ table: "Jobs");
+
+ migrationBuilder.AlterColumn(
+ 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");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_Jobs_JobTypes_JobTypeId",
+ table: "Jobs");
+
+ migrationBuilder.AlterColumn(
+ 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);
+ }
+ }
+}
diff --git a/PARR.DAL/Migrations/DataContextModelSnapshot.cs b/PARR.DAL/Migrations/DataContextModelSnapshot.cs
index d7d3894b..14add7a5 100644
--- a/PARR.DAL/Migrations/DataContextModelSnapshot.cs
+++ b/PARR.DAL/Migrations/DataContextModelSnapshot.cs
@@ -28,9 +28,6 @@ namespace PARR.DAL.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
- b.Property("ApplicationId")
- .HasColumnType("uuid");
-
b.Property("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("ApplicationTypeId")
+ .HasColumnType("uuid");
+
b.Property("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("JobModeId")
.HasColumnType("uuid");
- b.Property("JobTypeId")
+ b.Property("JobTypeId")
.HasColumnType("uuid");
b.Property("Name")
@@ -256,8 +256,8 @@ namespace PARR.DAL.Migrations
b.Property("DateModified")
.HasColumnType("timestamp with time zone");
- b.Property("DateOper")
- .HasColumnType("text");
+ b.Property("DateOper")
+ .HasColumnType("timestamp with time zone");
b.Property("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");
diff --git a/PARR.DAL/Models/Application.cs b/PARR.DAL/Models/Application.cs
index 19692cf3..58f734ae 100644
--- a/PARR.DAL/Models/Application.cs
+++ b/PARR.DAL/Models/Application.cs
@@ -19,6 +19,6 @@ namespace PARR.DAL.Models
public ICollection ApplicationsInHosts { get; set; } = new HashSet();
- public ICollection Applications { get;set; } = new HashSet();
+ //public ICollection Applications { get;set; } = new HashSet();
}
}
diff --git a/PARR.DAL/Models/ApplicationType.cs b/PARR.DAL/Models/ApplicationType.cs
index f6ed75e6..df1cc841 100644
--- a/PARR.DAL/Models/ApplicationType.cs
+++ b/PARR.DAL/Models/ApplicationType.cs
@@ -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 ApplicationTypes { get; set; } = new HashSet();
}
}
diff --git a/PARR.DAL/Models/Job.cs b/PARR.DAL/Models/Job.cs
index 0b10d90c..e18b12ea 100644
--- a/PARR.DAL/Models/Job.cs
+++ b/PARR.DAL/Models/Job.cs
@@ -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; }
diff --git a/PARR.DAL/Services/Implementations/JobJournalService.cs b/PARR.DAL/Services/Implementations/JobJournalService.cs
index 322caf24..6317c97f 100644
--- a/PARR.DAL/Services/Implementations/JobJournalService.cs
+++ b/PARR.DAL/Services/Implementations/JobJournalService.cs
@@ -24,17 +24,17 @@ namespace PARR.DAL.Services.Implementations
public async Task 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;
}
}