Files
parr_api/PARR.TemplateTaskGenerator/Services/ValidatorService.cs

37 lines
910 B
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;
namespace PARR.TemplateTaskGenerator.Services
{
internal class ValidatorService : IValidatorService
{
private readonly ILogger<ValidatorService> logger;
private readonly IJobService jobService;
public ValidatorService(
ILogger<ValidatorService> logger,
IJobService jobService
)
{
this.logger = logger;
this.jobService = jobService;
}
public async Task<bool> IsValidAsync(Guid jobId)
{
var isExist = await jobService.GetAsync(jobId);
if (isExist == null)
{
logger.LogError($"Не найдена регалментная работа {nameof(jobId)}: {jobId}");
return false;
}
return true;
}
}
}