feat(templateMatcher): Рефакторинг, основной метод синхронизации GroupedTemplateSynchronizer разбит на отдельные классы; Неиспользуемые шаблоны теперь привязываются к ЭК КОСМПЛЕКСЫ-[ЗО].
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using PARR.Core.Services.Shortcodes;
|
||||
using PARR.Domain.Entities;
|
||||
using PARR.TemplateMatcher.Services.Interfaces;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace PARR.TemplateMatcher.Services.Implementations;
|
||||
|
||||
internal class TemplateNameNormalizer : ITemplateNameNormalizer
|
||||
{
|
||||
private readonly IShortcodesService shortcodesService;
|
||||
|
||||
public TemplateNameNormalizer(IShortcodesService shortcodesService)
|
||||
{
|
||||
this.shortcodesService = shortcodesService;
|
||||
}
|
||||
|
||||
|
||||
public async Task<string> GetNormalizedTemplateNameAsync(Template template, [CallerMemberName] string? caller = null)
|
||||
{
|
||||
var callerName = caller ?? "Unknown";
|
||||
|
||||
if (template.Job == null)
|
||||
throw new ArgumentNullException(nameof(template.Job));
|
||||
|
||||
var rawName = await shortcodesService.ApplyShortcodesAsync(template.Job.TemplateNameMask, template, callerName);
|
||||
|
||||
return rawName.ToUpper();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user