feat(dal, domain): Для таблице UnitInTemplates добавлена связь с UnitFieldValues. В таблице Templates убраны значения по умолчанию для поле JobId, UnitId.
This commit is contained in:
@@ -65,7 +65,7 @@ namespace PARR.DAL.Context
|
|||||||
public DbSet<Order> Orders { get; set; }
|
public DbSet<Order> Orders { get; set; }
|
||||||
public DbSet<OrderStatus> OrderStatuses { get; set; }
|
public DbSet<OrderStatus> OrderStatuses { get; set; }
|
||||||
|
|
||||||
public DbSet<User> Users { get; set; }
|
public DbSet<Domain.Entities.User> Users { get; set; }
|
||||||
public DbSet<Role> Roles { get; set; }
|
public DbSet<Role> Roles { get; set; }
|
||||||
public DbSet<UsersInRole> UsersInRoles { get; set; }
|
public DbSet<UsersInRole> UsersInRoles { get; set; }
|
||||||
|
|
||||||
@@ -135,6 +135,11 @@ namespace PARR.DAL.Context
|
|||||||
|
|
||||||
var dateCreated = new DateTimeOffset(2023, 05, 01, 0, 0, 0, new TimeSpan(0));
|
var dateCreated = new DateTimeOffset(2023, 05, 01, 0, 0, 0, new TimeSpan(0));
|
||||||
|
|
||||||
|
//Задать значение по умолчанию
|
||||||
|
//modelBuilder.Entity<UnitsInTemplate>()
|
||||||
|
// .Property(t => t.UnitFieldValueId)
|
||||||
|
// .HasDefaultValue(new Guid("d6485475-d4c5-47f0-a48f-b364a6321cc4"));
|
||||||
|
|
||||||
#region Unit
|
#region Unit
|
||||||
//Добавляем ограничение по имени ЭК. нельзя писать прописными!!!
|
//Добавляем ограничение по имени ЭК. нельзя писать прописными!!!
|
||||||
modelBuilder.Entity<Unit>(f =>
|
modelBuilder.Entity<Unit>(f =>
|
||||||
@@ -148,7 +153,8 @@ namespace PARR.DAL.Context
|
|||||||
|
|
||||||
#region UnitsInTemplate
|
#region UnitsInTemplate
|
||||||
modelBuilder.Entity<UnitsInTemplate>()
|
modelBuilder.Entity<UnitsInTemplate>()
|
||||||
.HasKey(t => new { t.TemplateId, t.UnitId });
|
.HasKey(t => new { t.TemplateId, t.UnitId, t.UnitFieldValueId });
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region JobGroupType
|
#region JobGroupType
|
||||||
@@ -569,9 +575,9 @@ namespace PARR.DAL.Context
|
|||||||
|
|
||||||
#region TaskType
|
#region TaskType
|
||||||
|
|
||||||
modelBuilder.Entity<TaskType>(f =>
|
modelBuilder.Entity<Domain.Entities.TaskEntities.TaskType>(f =>
|
||||||
{
|
{
|
||||||
f.HasData(new TaskType[]
|
f.HasData(new Domain.Entities.TaskEntities.TaskType[]
|
||||||
{
|
{
|
||||||
new() { Code = TaskTypeEnum.Workload, Name = TaskTypeEnum.Workload.ToString(), Description = "Формирование данных для отчетности - Загруженность", MaxRetries = 2, IsSingleton=true, MaxExecutionTimeMinutes=60, RetentionDays=90 }
|
new() { Code = TaskTypeEnum.Workload, Name = TaskTypeEnum.Workload.ToString(), Description = "Формирование данных для отчетности - Загруженность", MaxRetries = 2, IsSingleton=true, MaxExecutionTimeMinutes=60, RetentionDays=90 }
|
||||||
}
|
}
|
||||||
|
|||||||
3810
PARR.DAL/Migrations/20260512062119_tblUnitsInTemplateAddUnitFieldValueId.Designer.cs
generated
Normal file
3810
PARR.DAL/Migrations/20260512062119_tblUnitsInTemplateAddUnitFieldValueId.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,96 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace PARR.DAL.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class tblUnitsInTemplateAddUnitFieldValueId : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_UnitsInTemplates",
|
||||||
|
schema: "job",
|
||||||
|
table: "UnitsInTemplates");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "UnitFieldValueId",
|
||||||
|
schema: "job",
|
||||||
|
table: "UnitsInTemplates",
|
||||||
|
type: "uuid",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new Guid("d6485475-d4c5-47f0-a48f-b364a6321cc4"));
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_UnitsInTemplates",
|
||||||
|
schema: "job",
|
||||||
|
table: "UnitsInTemplates",
|
||||||
|
columns: new[] { "TemplateId", "UnitId", "UnitFieldValueId" });
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
schema: "task",
|
||||||
|
table: "Types",
|
||||||
|
keyColumn: "Code",
|
||||||
|
keyValue: 0,
|
||||||
|
column: "MaxExecutionTimeMinutes",
|
||||||
|
value: 60);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_UnitsInTemplates_UnitFieldValueId",
|
||||||
|
schema: "job",
|
||||||
|
table: "UnitsInTemplates",
|
||||||
|
column: "UnitFieldValueId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_UnitsInTemplates_FieldValues_UnitFieldValueId",
|
||||||
|
schema: "job",
|
||||||
|
table: "UnitsInTemplates",
|
||||||
|
column: "UnitFieldValueId",
|
||||||
|
principalSchema: "unit",
|
||||||
|
principalTable: "FieldValues",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_UnitsInTemplates_FieldValues_UnitFieldValueId",
|
||||||
|
schema: "job",
|
||||||
|
table: "UnitsInTemplates");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_UnitsInTemplates",
|
||||||
|
schema: "job",
|
||||||
|
table: "UnitsInTemplates");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_UnitsInTemplates_UnitFieldValueId",
|
||||||
|
schema: "job",
|
||||||
|
table: "UnitsInTemplates");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "UnitFieldValueId",
|
||||||
|
schema: "job",
|
||||||
|
table: "UnitsInTemplates");
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_UnitsInTemplates",
|
||||||
|
schema: "job",
|
||||||
|
table: "UnitsInTemplates",
|
||||||
|
columns: new[] { "TemplateId", "UnitId" });
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
schema: "task",
|
||||||
|
table: "Types",
|
||||||
|
keyColumn: "Code",
|
||||||
|
keyValue: 0,
|
||||||
|
column: "MaxExecutionTimeMinutes",
|
||||||
|
value: 30);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3808
PARR.DAL/Migrations/20260512062439_tblUnitsInTemplateAddUnitFieldValueIdUnsetDefault.Designer.cs
generated
Normal file
3808
PARR.DAL/Migrations/20260512062439_tblUnitsInTemplateAddUnitFieldValueIdUnsetDefault.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,59 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace PARR.DAL.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class tblUnitsInTemplateAddUnitFieldValueIdUnsetDefault : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<Guid>(
|
||||||
|
name: "UnitFieldValueId",
|
||||||
|
schema: "job",
|
||||||
|
table: "UnitsInTemplates",
|
||||||
|
type: "uuid",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(Guid),
|
||||||
|
oldType: "uuid",
|
||||||
|
oldDefaultValue: new Guid("d6485475-d4c5-47f0-a48f-b364a6321cc4"));
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<Guid>(
|
||||||
|
name: "JobId",
|
||||||
|
schema: "public",
|
||||||
|
table: "Templates",
|
||||||
|
type: "uuid",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(Guid),
|
||||||
|
oldType: "uuid",
|
||||||
|
oldDefaultValue: new Guid("ba05948b-b040-48cc-ab77-0accc9c223a0"));
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<Guid>(
|
||||||
|
name: "UnitId",
|
||||||
|
schema: "public",
|
||||||
|
table: "Templates",
|
||||||
|
type: "uuid",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(Guid),
|
||||||
|
oldType: "uuid",
|
||||||
|
oldDefaultValue: new Guid("b4dfd71a-2b2f-414f-8409-4b9abd9c4d2c"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<Guid>(
|
||||||
|
name: "UnitFieldValueId",
|
||||||
|
schema: "job",
|
||||||
|
table: "UnitsInTemplates",
|
||||||
|
type: "uuid",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new Guid("d6485475-d4c5-47f0-a48f-b364a6321cc4"),
|
||||||
|
oldClrType: typeof(Guid),
|
||||||
|
oldType: "uuid");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -2,20 +2,28 @@
|
|||||||
using PARR.Domain.Constants;
|
using PARR.Domain.Constants;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace PARR.Domain.Entities
|
namespace PARR.Domain.Entities.Job
|
||||||
{
|
{
|
||||||
[Table("UnitsInTemplates", Schema = DatabaseSchemas.Job)]
|
[Table("UnitsInTemplates", Schema = DatabaseSchemas.Job)]
|
||||||
[Comment("Таблица связи ЭК в шаблонах")]
|
[Comment("Таблица связи ЭК в шаблонах")]
|
||||||
public class UnitsInTemplate
|
public class UnitsInTemplate
|
||||||
{
|
{
|
||||||
public Guid TemplateId { get; set; }
|
public Guid TemplateId { get; set; }
|
||||||
|
|
||||||
public Guid UnitId { get; set; }
|
public Guid UnitId { get; set; }
|
||||||
|
|
||||||
public DateTimeOffset DateCreated { get; set; }
|
public DateTimeOffset DateCreated { get; set; }
|
||||||
|
|
||||||
|
public Guid UnitFieldValueId { get; set; }
|
||||||
|
|
||||||
[ForeignKey(nameof(TemplateId))]
|
[ForeignKey(nameof(TemplateId))]
|
||||||
public Template? Template { get; set; }
|
public Template? Template { get; set; }
|
||||||
|
|
||||||
[ForeignKey(nameof(UnitId))]
|
[ForeignKey(nameof(UnitId))]
|
||||||
public Unit.Unit? Unit { get; set; }
|
public Unit.Unit? Unit { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey(nameof(UnitFieldValueId))]
|
||||||
|
public Unit.UnitFieldValue? UnitFieldValue { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
using PARR.Domain.Entities.Base;
|
using PARR.Domain.Entities.Base;
|
||||||
using PARR.Domain.Entities.Base.History;
|
using PARR.Domain.Entities.Base.History;
|
||||||
using PARR.Domain.Entities.Base.History.Base;
|
using PARR.Domain.Entities.Base.History.Base;
|
||||||
|
using PARR.Domain.Entities.Job;
|
||||||
using PARR.Domain.Enums;
|
using PARR.Domain.Enums;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using PARR.Domain.Constants;
|
using PARR.Domain.Constants;
|
||||||
using PARR.Domain.Entities.Base;
|
using PARR.Domain.Entities.Base;
|
||||||
|
using PARR.Domain.Entities.Job;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using PARR.Domain.Constants;
|
using PARR.Domain.Constants;
|
||||||
using PARR.Domain.Entities.Base;
|
using PARR.Domain.Entities.Base;
|
||||||
|
using PARR.Domain.Entities.Job;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
@@ -27,5 +28,7 @@ namespace PARR.Domain.Entities.Unit
|
|||||||
public ICollection<UnitFieldInUnitFieldValue> FieldValues { get; set; } = new HashSet<UnitFieldInUnitFieldValue>();
|
public ICollection<UnitFieldInUnitFieldValue> FieldValues { get; set; } = new HashSet<UnitFieldInUnitFieldValue>();
|
||||||
|
|
||||||
public UnitRegionalEkPtkGroup? RegionalEkPtkGroup { get; set; }
|
public UnitRegionalEkPtkGroup? RegionalEkPtkGroup { get; set; }
|
||||||
|
|
||||||
|
public ICollection<UnitsInTemplate> UnitsInTemplates { get; set; } = new HashSet<UnitsInTemplate>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using PARR.Core.Services.Shortcodes;
|
|||||||
using PARR.Domain.Common.Rabbit.Messages;
|
using PARR.Domain.Common.Rabbit.Messages;
|
||||||
using PARR.Domain.Entities;
|
using PARR.Domain.Entities;
|
||||||
using PARR.Domain.Entities.Base.History;
|
using PARR.Domain.Entities.Base.History;
|
||||||
|
using PARR.Domain.Entities.Job;
|
||||||
using PARR.Domain.Enums;
|
using PARR.Domain.Enums;
|
||||||
using PARR.TemplateGeneratorWorker.Services;
|
using PARR.TemplateGeneratorWorker.Services;
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using PARR.Core.Repositories.Interfaces.Job;
|
|||||||
using PARR.Domain.Common.Rabbit.Messages;
|
using PARR.Domain.Common.Rabbit.Messages;
|
||||||
using PARR.Domain.Entities;
|
using PARR.Domain.Entities;
|
||||||
using PARR.Domain.Entities.Base.History;
|
using PARR.Domain.Entities.Base.History;
|
||||||
|
using PARR.Domain.Entities.Job;
|
||||||
using PARR.Domain.Enums;
|
using PARR.Domain.Enums;
|
||||||
using PARR.Domain.Settings;
|
using PARR.Domain.Settings;
|
||||||
using PARR.TemplateMatcher.Services.Interfaces;
|
using PARR.TemplateMatcher.Services.Interfaces;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using PARR.Core.Repositories.Interfaces.Unit;
|
|||||||
using PARR.Core.Services.NextRunServices;
|
using PARR.Core.Services.NextRunServices;
|
||||||
using PARR.Domain.Common.Rabbit.Messages;
|
using PARR.Domain.Common.Rabbit.Messages;
|
||||||
using PARR.Domain.Entities;
|
using PARR.Domain.Entities;
|
||||||
|
using PARR.Domain.Entities.Job;
|
||||||
using PARR.Domain.Enums;
|
using PARR.Domain.Enums;
|
||||||
|
|
||||||
namespace PARR.TemplateUpdater.Services
|
namespace PARR.TemplateUpdater.Services
|
||||||
|
|||||||
Reference in New Issue
Block a user