feat(templateTaskGenerator): Написан TemplateTaskGenerator, читает очередь Mq parr-template-task-generator при получении id регламентной работы проверяет несозданные шаблоны. При наличии таковых пишет сообщение в очередь parr-template-generator
This commit is contained in:
36
TemplateTaskGenerator/Services/ValidatorService.cs
Normal file
36
TemplateTaskGenerator/Services/ValidatorService.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user