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

34 lines
982 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;
using PARR.TemplateMatcher.Services.Interfaces;
namespace PARR.TemplateMatcher.Services.Implemetaions
{
internal class JobValidatorService : IJobValidatorService
{
private readonly ILogger<IJobValidatorService> logger;
private readonly IJobService jobService;
public JobValidatorService(
ILogger<IJobValidatorService> logger,
IJobService jobService
)
{
this.logger = logger;
this.jobService = jobService;
}
public async Task<bool> IsValidJobAsync(Guid jobId)
{
var isExist = await jobService.GetAsync(jobId);
if (isExist == null)
{
logger.LogError($"Не найдена регалментная работа {nameof(jobId)}: {jobId}");
return false;
}
return true;
}
}
}