2025-12-19 19:15:58 +10:00
|
|
|
|
using Microsoft.Extensions.Logging;
|
2026-07-03 11:25:39 +10:00
|
|
|
|
using PARR.Core.Repositories.Interfaces.JobGroupRepositories;
|
2025-12-19 19:15:58 +10:00
|
|
|
|
using PARR.TemplateMatcher.Services.Interfaces;
|
|
|
|
|
|
|
2026-06-11 15:09:46 +10:00
|
|
|
|
namespace PARR.TemplateMatcher.Services.Implementations
|
2025-12-19 19:15:58 +10:00
|
|
|
|
{
|
|
|
|
|
|
internal class JobGroupValidatorService : IJobGroupValidatorService
|
|
|
|
|
|
{
|
2026-06-11 15:09:46 +10:00
|
|
|
|
private readonly ILogger<IJobValidatorService> _logger;
|
|
|
|
|
|
private readonly IJobGroupRepository _jobGroupService;
|
2025-12-19 19:15:58 +10:00
|
|
|
|
|
|
|
|
|
|
public JobGroupValidatorService(
|
|
|
|
|
|
ILogger<IJobValidatorService> logger,
|
2026-04-30 10:35:31 +10:00
|
|
|
|
IJobGroupRepository jobGroupService
|
2025-12-19 19:15:58 +10:00
|
|
|
|
)
|
|
|
|
|
|
{
|
2026-06-11 15:09:46 +10:00
|
|
|
|
_logger = logger;
|
|
|
|
|
|
_jobGroupService = jobGroupService;
|
2025-12-19 19:15:58 +10:00
|
|
|
|
}
|
|
|
|
|
|
public async Task<bool> IsValidJobGroupAsync(Guid jobGroupId)
|
|
|
|
|
|
{
|
2026-06-11 15:09:46 +10:00
|
|
|
|
var isExist = await _jobGroupService.GetAsync(jobGroupId);
|
2025-12-19 19:15:58 +10:00
|
|
|
|
|
|
|
|
|
|
if (isExist == null)
|
|
|
|
|
|
{
|
2026-06-11 15:09:46 +10:00
|
|
|
|
_logger.LogError($"Не найдена регалментная работа {nameof(jobGroupId)}: {jobGroupId}");
|
2025-12-19 19:15:58 +10:00
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|