Files
Mikhail Kuznetsov 83c6a5f605 feat(templateMatcher):
- добавлен режим DryRun
- изменен подход к фильтрации шаблонов по рабочей группе - перенесено из этапа основной фильтрации в этап посторение подргупп/шаблонов
- при использовании тегов альтернативных рабочих групп фильтрация по списку пропускается
2026-09-09 17:09:57 +10:00

44 lines
1.7 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using PARR.Domain.Entities;
using PARR.Domain.Entities.Base.History;
using PARR.Domain.Entities.JobEntities;
namespace PARR.TemplateMatcher.Services.SimpleSync
{
/// <summary>
/// Контекст синхронизации простого шаблона. Передаётся между этапами.
/// </summary>
public class SimpleSyncContext
{
public Guid JobId { get; init; }
public string JobName { get; set; } = string.Empty;
public HistoryInitiator Initiator { get; init; } = null!;
// Флаг режима сухого запуска
public bool DryRun { get; init; }
public Job Job { get; set; } = null!;
public HashSet<Guid> FilteredUnitIds { get; set; } = new();
/// <summary>
/// Имена юнитов для логирования. Заполняется на этапе фильтрации.
/// </summary>
public Dictionary<Guid, string> UnitNames { get; set; } = new();
public List<Template> ExistingUsedTemplates { get; set; } = new();
public List<Guid> NewUnitIds { get; set; } = new();
public List<Template> UnusedTemplates { get; set; } = new();
public List<(Template Template, string ExpectedName)> TemplatesToRename { get; set; } = new();
/// <summary>
/// Возвращает строку вида 'Имя' (ID) для логирования.
/// Если имя неизвестно — возвращает только ID.
/// </summary>
public string FormatUnit(Guid unitId)
{
return UnitNames.TryGetValue(unitId, out var name)
? $"'{name}' ({unitId})"
: $"({unitId})";
}
}
}