feat(aihitRelationshipsSyncer): Реализована логика синхронизации связей между Unit+CI/CD

This commit is contained in:
Mikhail Kuznetsov
2025-05-27 11:32:05 +10:00
parent cc52818d29
commit 078c8b540f
33 changed files with 4389 additions and 6 deletions

View File

@@ -31,5 +31,18 @@ namespace PARR.DAL.Models.Unit
public ICollection<UnitInField> UnitFields { get; set; } = new HashSet<UnitInField>();
public ICollection<UnitInValue> UnitValues { get; set; } = new HashSet<UnitInValue>();
/// <summary>
/// Получить всех родителей
/// </summary>
[InverseProperty(nameof(UnitInUnit.ChildUnit))]
public ICollection<UnitInUnit> ParentUnits { get; set; } = new HashSet<UnitInUnit>();
/// <summary>
/// Получить детей
/// </summary>
[InverseProperty(nameof(UnitInUnit.ParentUnit))]
public ICollection<UnitInUnit> ChildUnits { get; set; } = new HashSet<UnitInUnit>();
}
}

View File

@@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Unit
{
/// <summary>
/// Связи иерархии между ЭК
/// </summary>
[Table("UnitInUnits", Schema = DataContextSettings.Unit)]
[Comment("Таблица связей иерархии между ЭК")]
[PrimaryKey(nameof(ParentUnitId), nameof(ChildUnitId))]
public class UnitInUnit
{
public Guid ParentUnitId { get; set; }
public Guid ChildUnitId { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateSynced { get; set; }
[ForeignKey(nameof(ParentUnitId))]
public Unit? ParentUnit { get; set; }
[ForeignKey(nameof(ChildUnitId))]
public Unit? ChildUnit { get; set; }
}
}