Files
parr_api/PARR.TemplateMatcher/Services/Implemetaions/JobGroupValidatorService.cs

34 lines
1.0 KiB
C#
Raw 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 Microsoft.Extensions.Logging;
using PARR.DAL.Services.Interfaces.Job;
using PARR.TemplateMatcher.Services.Interfaces;
namespace PARR.TemplateMatcher.Services.Implemetaions
{
internal class JobGroupValidatorService : IJobGroupValidatorService
{
private readonly ILogger<IJobValidatorService> logger;
private readonly IJobGroupService jobGroupService;
public JobGroupValidatorService(
ILogger<IJobValidatorService> logger,
IJobGroupService jobGroupService
)
{
this.logger = logger;
this.jobGroupService = jobGroupService;
}
public async Task<bool> IsValidJobGroupAsync(Guid jobGroupId)
{
var isExist = await jobGroupService.GetAsync(jobGroupId);
if (isExist == null)
{
logger.LogError($"Не найдена регалментная работа {nameof(jobGroupId)}: {jobGroupId}");
return false;
}
return true;
}
}
}