feat(dal): Созданы таблицы схемы Job

This commit is contained in:
Mikhail Kuznetsov
2025-06-04 11:55:23 +10:00
parent 7b1c676507
commit 50ef7dee5c
18 changed files with 8117 additions and 10 deletions

View File

@@ -1,12 +1,13 @@
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using PARR.API.Contracts.V1; using PARR.API.Contracts.V1;
using PARR.API.Contracts.V1.Responses.Base; using PARR.API.Contracts.V1.Responses.Base;
using PARR.API.Controllers.V1.Base; using PARR.API.Controllers.V1.Base;
using PARR.API.Services.Interfaces; using PARR.API.Services.Interfaces;
using PARR.DAL.CacheServices; using PARR.DAL.CacheServices;
using PARR.DAL.Models.Job;
using PARR.DAL.Services.Interfaces; using PARR.DAL.Services.Interfaces;
using PARR.DAL.Services.Interfaces.Job;
using PARR.DAL.Services.Interfaces.Unit; using PARR.DAL.Services.Interfaces.Unit;
using PARR.DAL.TransformServices; using PARR.DAL.TransformServices;
@@ -20,13 +21,19 @@ namespace PARR.API.Controllers.V1
private readonly IRedisCacheService redisCacheService; private readonly IRedisCacheService redisCacheService;
private readonly IWeekendDayService weekendDayService; private readonly IWeekendDayService weekendDayService;
private readonly IUnitService unitService; private readonly IUnitService unitService;
private readonly IFieldFilterService fieldFilterService;
private readonly IJobService jobService;
private readonly IJobDetailsService jobDetailsService;
public TestController( public TestController(
IClientService clientService, IClientService clientService,
IEsppScheduleTransformService esppScheduleTransformService, IEsppScheduleTransformService esppScheduleTransformService,
IRedisCacheService redisCacheService, IRedisCacheService redisCacheService,
IWeekendDayService weekendDayService, IWeekendDayService weekendDayService,
IUnitService unitService IUnitService unitService,
IFieldFilterService fieldFilterService,
IJobService jobService,
IJobDetailsService jobDetailsService
) )
{ {
this.clientService = clientService; this.clientService = clientService;
@@ -34,6 +41,9 @@ namespace PARR.API.Controllers.V1
this.redisCacheService = redisCacheService; this.redisCacheService = redisCacheService;
this.weekendDayService = weekendDayService; this.weekendDayService = weekendDayService;
this.unitService = unitService; this.unitService = unitService;
this.fieldFilterService = fieldFilterService;
this.jobService = jobService;
this.jobDetailsService = jobDetailsService;
} }
@@ -115,6 +125,39 @@ namespace PARR.API.Controllers.V1
[HttpGet(ApiRoutes.Test.TestHandler)] [HttpGet(ApiRoutes.Test.TestHandler)]
public async Task<IActionResult> Test() public async Task<IActionResult> Test()
{ {
//var job = new Job
//{
// Id = Guid.NewGuid(),
// Name = "ВИ-VMWARE ТО-1 Мониторинг и анализ работы виртуальной инфраструктуры",
// DateCreated = DateTimeOffset.Now,
// TemplateNameMask = "ЭИТИ_%РГ%_%ТНК%_%ЭК%",
// TnkId = Guid.Parse("9b7e0251-cb13-427c-ac71-16baa2a111dd")
//};
//var jobDetails = new JobDetails {
// Id = Guid.NewGuid(),
// UnitFilter = "ВРТ-VMWARE-*",
// JobId = job.Id,
// ShortDescription = "Мониторинг и анализ работы виртуальной инфраструктуры",
// FullDescription = "Проверка журналов (лог-файла) событий (warning, alarm) объектов виртуальной инфраструктуры (ВМ, хост, кластер, датацентр, virtual center и др.)",
// Solution = "Работы проведены",
// Duration = "7 00:00:00",
// ReferenceDate = new DateTimeOffset(2026,01,01,00,00,00,new TimeSpan(0))
//};
//var fieldFilter = new FieldFilter
//{
// Id = Guid.NewGuid(),
// JobDetailsId = jobDetails.Id,
// FieldId = Guid.Parse("08b42860-09a7-4a1f-aa4f-0290e86df884"),
// ValueMask = "виртуальный комплекс"
//};
////await jobService.CreateAsync(job);
////await jobService.CommitAsync();
//if (await jobService.CreateAsync(job))
// if (await jobDetailsService.CreateAsync(jobDetails))
// if (await fieldFilterService.CreateAsync(fieldFilter))
// await jobService.CommitAsync();
//var unit = await unitService.Get().Include(t => t.Parents).Include(t => t.Childs).FirstOrDefaultAsync(t => t.Id == Guid.Parse("01fda0bd-3423-4b12-965b-2947153d1d87")); //var unit = await unitService.Get().Include(t => t.Parents).Include(t => t.Childs).FirstOrDefaultAsync(t => t.Id == Guid.Parse("01fda0bd-3423-4b12-965b-2947153d1d87"));
//var parent = unit?.Parents; //var parent = unit?.Parents;

View File

@@ -2,6 +2,7 @@
using PARR.Constants; using PARR.Constants;
using PARR.DAL.Contracts; using PARR.DAL.Contracts;
using PARR.DAL.Models; using PARR.DAL.Models;
using PARR.DAL.Models.Job;
using PARR.DAL.Models.Unit; using PARR.DAL.Models.Unit;
namespace PARR.DAL.Context namespace PARR.DAL.Context
@@ -82,6 +83,16 @@ namespace PARR.DAL.Context
#endregion #endregion
#region Job
public DbSet<FieldFilter> FieldFilters { get; set; }
public DbSet<Job> Jobs { get; set; }
public DbSet<JobDetails> JobDetails { get; set; }
#endregion
protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnModelCreating(ModelBuilder modelBuilder)
{ {

View File

@@ -7,5 +7,11 @@
/// </summary> /// </summary>
public const string Unit = "unit"; public const string Unit = "unit";
/// <summary>
/// Хранение информации о видах работ, критериях выборки подходящих под работы ЭК и т.д.
/// </summary>
public const string Job = "job";
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,146 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class tblsWorkInit : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.EnsureSchema(
name: "job");
migrationBuilder.CreateTable(
name: "Jobs",
schema: "job",
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: false),
IsUmbrella = table.Column<bool>(type: "boolean", nullable: true),
MinValueRelationships = table.Column<int>(type: "integer", nullable: true),
MaxValueRelationships = table.Column<int>(type: "integer", nullable: true),
TemplateNameMask = table.Column<string>(type: "text", nullable: true),
TnkId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Jobs", x => x.Id);
table.ForeignKey(
name: "FK_Jobs_Tnks_TnkId",
column: x => x.TnkId,
principalTable: "Tnks",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
},
comment: "Таблица видов работ");
migrationBuilder.CreateTable(
name: "JobDetails",
schema: "job",
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),
UnitFilter = table.Column<string>(type: "text", nullable: false),
JobId = table.Column<Guid>(type: "uuid", nullable: false),
ShortDescription = table.Column<string>(type: "text", nullable: false),
FullDescription = table.Column<string>(type: "text", nullable: false),
Solution = table.Column<string>(type: "text", nullable: false),
Duration = table.Column<string>(type: "text", nullable: false),
ReferenceDate = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_JobDetails", x => x.Id);
table.ForeignKey(
name: "FK_JobDetails_Jobs_JobId",
column: x => x.JobId,
principalSchema: "job",
principalTable: "Jobs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
},
comment: "Таблица описания критериев выборки ЭК, описание полей в АСУ ЕСПП");
migrationBuilder.CreateTable(
name: "FieldFilters",
schema: "job",
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),
JobDetailId = table.Column<Guid>(type: "uuid", nullable: false),
FieldId = table.Column<Guid>(type: "uuid", nullable: false),
ValueMask = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_FieldFilters", x => x.Id);
table.ForeignKey(
name: "FK_FieldFilters_Fields_FieldId",
column: x => x.FieldId,
principalSchema: "unit",
principalTable: "Fields",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_FieldFilters_JobDetails_JobDetailId",
column: x => x.JobDetailId,
principalSchema: "job",
principalTable: "JobDetails",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
},
comment: "Таблица описания критериев выборки аттрибутов ЭК");
migrationBuilder.CreateIndex(
name: "IX_FieldFilters_FieldId",
schema: "job",
table: "FieldFilters",
column: "FieldId");
migrationBuilder.CreateIndex(
name: "IX_FieldFilters_JobDetailId",
schema: "job",
table: "FieldFilters",
column: "JobDetailId");
migrationBuilder.CreateIndex(
name: "IX_JobDetails_JobId",
schema: "job",
table: "JobDetails",
column: "JobId");
migrationBuilder.CreateIndex(
name: "IX_Jobs_TnkId",
schema: "job",
table: "Jobs",
column: "TnkId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "FieldFilters",
schema: "job");
migrationBuilder.DropTable(
name: "JobDetails",
schema: "job");
migrationBuilder.DropTable(
name: "Jobs",
schema: "job");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,72 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class tblsFieldFiltersRenameColumn : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_FieldFilters_JobDetails_JobDetailId",
schema: "job",
table: "FieldFilters");
migrationBuilder.RenameColumn(
name: "JobDetailId",
schema: "job",
table: "FieldFilters",
newName: "JobDetailsId");
migrationBuilder.RenameIndex(
name: "IX_FieldFilters_JobDetailId",
schema: "job",
table: "FieldFilters",
newName: "IX_FieldFilters_JobDetailsId");
migrationBuilder.AddForeignKey(
name: "FK_FieldFilters_JobDetails_JobDetailsId",
schema: "job",
table: "FieldFilters",
column: "JobDetailsId",
principalSchema: "job",
principalTable: "JobDetails",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_FieldFilters_JobDetails_JobDetailsId",
schema: "job",
table: "FieldFilters");
migrationBuilder.RenameColumn(
name: "JobDetailsId",
schema: "job",
table: "FieldFilters",
newName: "JobDetailId");
migrationBuilder.RenameIndex(
name: "IX_FieldFilters_JobDetailsId",
schema: "job",
table: "FieldFilters",
newName: "IX_FieldFilters_JobDetailId");
migrationBuilder.AddForeignKey(
name: "FK_FieldFilters_JobDetails_JobDetailId",
schema: "job",
table: "FieldFilters",
column: "JobDetailId",
principalSchema: "job",
principalTable: "JobDetails",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@@ -1542,6 +1542,129 @@ namespace PARR.DAL.Migrations
b.ToTable("Hosts"); b.ToTable("Hosts");
}); });
modelBuilder.Entity("PARR.DAL.Models.Job.FieldFilter", 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<Guid>("FieldId")
.HasColumnType("uuid");
b.Property<Guid>("JobDetailsId")
.HasColumnType("uuid");
b.Property<string>("ValueMask")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("FieldId");
b.HasIndex("JobDetailsId");
b.ToTable("FieldFilters", "job", t =>
{
t.HasComment("Таблица описания критериев выборки аттрибутов ЭК");
});
});
modelBuilder.Entity("PARR.DAL.Models.Job.Job", 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<bool?>("IsUmbrella")
.HasColumnType("boolean");
b.Property<int?>("MaxValueRelationships")
.HasColumnType("integer");
b.Property<int?>("MinValueRelationships")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("TemplateNameMask")
.HasColumnType("text");
b.Property<Guid>("TnkId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TnkId");
b.ToTable("Jobs", "job", t =>
{
t.HasComment("Таблица видов работ");
});
});
modelBuilder.Entity("PARR.DAL.Models.Job.JobDetails", 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>("Duration")
.IsRequired()
.HasColumnType("text");
b.Property<string>("FullDescription")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("JobId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("ReferenceDate")
.HasColumnType("timestamp with time zone");
b.Property<string>("ShortDescription")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Solution")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UnitFilter")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("JobId");
b.ToTable("JobDetails", "job", t =>
{
t.HasComment("Таблица описания критериев выборки ЭК, описание полей в АСУ ЕСПП");
});
});
modelBuilder.Entity("PARR.DAL.Models.JobAutoControl", b => modelBuilder.Entity("PARR.DAL.Models.JobAutoControl", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@@ -3021,6 +3144,47 @@ namespace PARR.DAL.Migrations
b.Navigation("WorkGroup"); b.Navigation("WorkGroup");
}); });
modelBuilder.Entity("PARR.DAL.Models.Job.FieldFilter", b =>
{
b.HasOne("PARR.DAL.Models.Unit.UnitField", "Field")
.WithMany()
.HasForeignKey("FieldId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.Job.JobDetails", "JobDetails")
.WithMany("fieldFilters")
.HasForeignKey("JobDetailsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Field");
b.Navigation("JobDetails");
});
modelBuilder.Entity("PARR.DAL.Models.Job.Job", b =>
{
b.HasOne("PARR.DAL.Models.Tnk", "Tnk")
.WithMany()
.HasForeignKey("TnkId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tnk");
});
modelBuilder.Entity("PARR.DAL.Models.Job.JobDetails", b =>
{
b.HasOne("PARR.DAL.Models.Job.Job", "Job")
.WithMany("JobDetails")
.HasForeignKey("JobId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Job");
});
modelBuilder.Entity("PARR.DAL.Models.JobAutoControl", b => modelBuilder.Entity("PARR.DAL.Models.JobAutoControl", b =>
{ {
b.HasOne("PARR.DAL.Models.ApplicationsInWork", "ApplicationsInWork") b.HasOne("PARR.DAL.Models.ApplicationsInWork", "ApplicationsInWork")
@@ -3239,21 +3403,21 @@ namespace PARR.DAL.Migrations
modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInUnit", b => modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInUnit", b =>
{ {
b.HasOne("PARR.DAL.Models.Unit.Unit", "Child") b.HasOne("PARR.DAL.Models.Unit.Unit", "ChildUnit")
.WithMany("Parents") .WithMany("ParentUnits")
.HasForeignKey("ChildUnitId") .HasForeignKey("ChildUnitId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("PARR.DAL.Models.Unit.Unit", "Parent") b.HasOne("PARR.DAL.Models.Unit.Unit", "ParentUnit")
.WithMany("Childs") .WithMany("ChildUnits")
.HasForeignKey("ParentUnitId") .HasForeignKey("ParentUnitId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Child"); b.Navigation("ChildUnit");
b.Navigation("Parent"); b.Navigation("ParentUnit");
}); });
modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInValue", b => modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInValue", b =>
@@ -3398,6 +3562,16 @@ namespace PARR.DAL.Migrations
b.Navigation("Templates"); b.Navigation("Templates");
}); });
modelBuilder.Entity("PARR.DAL.Models.Job.Job", b =>
{
b.Navigation("JobDetails");
});
modelBuilder.Entity("PARR.DAL.Models.Job.JobDetails", b =>
{
b.Navigation("fieldFilters");
});
modelBuilder.Entity("PARR.DAL.Models.JobAutoControl", b => modelBuilder.Entity("PARR.DAL.Models.JobAutoControl", b =>
{ {
b.Navigation("JobAutoControlInEkStatuses"); b.Navigation("JobAutoControlInEkStatuses");
@@ -3484,9 +3658,9 @@ namespace PARR.DAL.Migrations
modelBuilder.Entity("PARR.DAL.Models.Unit.Unit", b => modelBuilder.Entity("PARR.DAL.Models.Unit.Unit", b =>
{ {
b.Navigation("Childs"); b.Navigation("ChildUnits");
b.Navigation("Parents"); b.Navigation("ParentUnits");
b.Navigation("UnitFields"); b.Navigation("UnitFields");

View File

@@ -0,0 +1,34 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.DAL.Models.Base;
using PARR.DAL.Models.Unit;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Job
{
[Table("FieldFilters", Schema = DataContextSettings.Job)]
[Comment("Таблица описания критериев выборки аттрибутов ЭК")]
public class FieldFilter : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public Guid JobDetailsId { get; set; }
public Guid FieldId { get; set; }
public required string ValueMask { get; set; }
[ForeignKey(nameof(FieldId))]
public UnitField? Field { get; set; }
[ForeignKey(nameof(JobDetailsId))]
public JobDetails? JobDetails { get; set; }
}
}

View File

@@ -0,0 +1,52 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Job
{
[Table("Jobs", Schema = DataContextSettings.Job)]
[Comment("Таблица видов работ")]
public class Job : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
/// <summary>
/// Наименование работ
/// </summary>
public required string Name { get; set; }
/// <summary>
/// Связана ли работа с групповыми ЭК(зонтами)
/// </summary>
public bool? IsUmbrella { get; set; }
/// <summary>
/// Минимальное значение дочерних связей группового ЭК
/// </summary>
public int? MinValueRelationships { get; set; }
/// <summary>
/// Максимальное значение дочерних связей группового ЭК
/// </summary>
public int? MaxValueRelationships { get; set; }
/// <summary>
/// Маска для динамического формирования имени шаблона
/// </summary>
public string? TemplateNameMask { get; set; }
public Guid TnkId { get; set; }
[ForeignKey(nameof(TnkId))]
public Tnk? Tnk { get; set; }
public ICollection<JobDetails> JobDetails { get; set; }= new HashSet<JobDetails>();
}
}

View File

@@ -0,0 +1,54 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Job
{
[Table("JobDetails", Schema = DataContextSettings.Job)]
[Comment("Таблица описания критериев выборки ЭК, описание полей в АСУ ЕСПП")]
public class JobDetails : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string UnitFilter { get; set; }
public Guid JobId { get; set; }
/// <summary>
/// Поле Короткое описания шаблона АСУ ЕСПП
/// </summary>
public required string ShortDescription { get; set; }
/// <summary>
/// Поле Подробное описания шаблона АСУ ЕСПП
/// </summary>
public required string FullDescription { get; set; }
/// <summary>
/// Поле Решение описания шаблона АСУ ЕСПП
/// </summary>
public required string Solution { get; set; }
/// <summary>
/// Поле Длительность описания шаблона АСУ ЕСПП
/// </summary>
public required string Duration { get; set; }
/// <summary>
/// Дата начала работ или дата для отсчёта периода следующего выполнения
/// </summary>
public DateTimeOffset ReferenceDate { get; set; }
[ForeignKey(nameof(JobId))]
public Job? Job { get; set; }
public ICollection<FieldFilter> fieldFilters { get; set; } = new HashSet<FieldFilter>();
}
}

View File

@@ -8,8 +8,10 @@ using PARR.DAL.Contracts;
using PARR.DAL.InfluxDbServices; using PARR.DAL.InfluxDbServices;
using PARR.DAL.Services.Implementation; using PARR.DAL.Services.Implementation;
using PARR.DAL.Services.Implementations; using PARR.DAL.Services.Implementations;
using PARR.DAL.Services.Implementations.Job;
using PARR.DAL.Services.Implementations.Unit; using PARR.DAL.Services.Implementations.Unit;
using PARR.DAL.Services.Interfaces; using PARR.DAL.Services.Interfaces;
using PARR.DAL.Services.Interfaces.Job;
using PARR.DAL.Services.Interfaces.Unit; using PARR.DAL.Services.Interfaces.Unit;
using PARR.DAL.Settings; using PARR.DAL.Settings;
using PARR.DAL.TransformServices; using PARR.DAL.TransformServices;
@@ -99,6 +101,13 @@ namespace PARR.DAL
#endregion #endregion
#region Job
services.AddTransient<IJobService, JobService>();
services.AddTransient<IJobDetailsService, JobDetailsService>();
services.AddTransient<IFieldFilterService, FieldFilterService>();
#endregion
// TransformServices // TransformServices
services.AddTransient<IEsppScheduleTransformService, EsppScheduleTransformService>(); services.AddTransient<IEsppScheduleTransformService, EsppScheduleTransformService>();

View File

@@ -0,0 +1,21 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.Job;
namespace PARR.DAL.Services.Implementations.Job
{
internal class FieldFilterService : BaseService<Models.Job.FieldFilter>, IFieldFilterService
{
private readonly DataContext dataContext;
protected override DbSet<Models.Job.FieldFilter> EntitySet => dataContext.FieldFilters;
protected override DataContext EntitiContext => dataContext;
public FieldFilterService(DataContext dataContext, ILogger<FieldFilterService> logger) : base(logger)
{
this.dataContext = dataContext;
}
}
}

View File

@@ -0,0 +1,23 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models.Job;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.Job;
namespace PARR.DAL.Services.Implementations.Job
{
internal class JobDetailsService : BaseService<Models.Job.JobDetails>, IJobDetailsService
{
private readonly DataContext dataContext;
protected override DbSet<JobDetails> EntitySet => dataContext.JobDetails;
protected override DataContext EntitiContext => dataContext;
public JobDetailsService(DataContext dataContext, ILogger<JobDetailsService> logger) : base(logger)
{
this.dataContext = dataContext;
}
}
}

View File

@@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.Job;
namespace PARR.DAL.Services.Implementations.Job
{
internal class JobService : BaseService<Models.Job.Job>, IJobService
{
private readonly DataContext dataContext;
public JobService(DataContext dataContext, ILogger<JobService> logger) : base(logger)
{
this.dataContext = dataContext;
}
protected override DbSet<Models.Job.Job> EntitySet => dataContext.Jobs;
protected override DataContext EntitiContext => dataContext;
}
}

View File

@@ -0,0 +1,8 @@
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.Job
{
public interface IFieldFilterService : IBaseService<Models.Job.FieldFilter>
{
}
}

View File

@@ -0,0 +1,8 @@
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.Job
{
public interface IJobDetailsService : IBaseService<Models.Job.JobDetails>
{
}
}

View File

@@ -0,0 +1,8 @@
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.Job
{
public interface IJobService : IBaseService<Models.Job.Job>
{
}
}