feat(api): JobControl переписан метод Create+Валидация
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.DAL.DomainServices.Interfaces;
|
||||
using PARR.DAL.Models.Job;
|
||||
using PARR.DAL.Services.Interfaces;
|
||||
using PARR.DAL.Services.Interfaces.Job;
|
||||
using PARR.DAL.Services.Interfaces.Unit;
|
||||
@@ -28,9 +29,9 @@ namespace PARR.DAL.DomainServices.Implementations
|
||||
this.templateService = templateService;
|
||||
}
|
||||
|
||||
|
||||
public async Task<IEnumerable<Guid>?> GetUnitsIdByJobFilterAsync(Guid jobId)
|
||||
{
|
||||
var result = new List<Guid>();
|
||||
|
||||
var job = await jobService
|
||||
.Get().AsNoTracking()
|
||||
@@ -44,6 +45,14 @@ namespace PARR.DAL.DomainServices.Implementations
|
||||
if (job == null)
|
||||
return null;
|
||||
|
||||
return await GetUnitsIdByJobFilterAsync(job);
|
||||
}
|
||||
|
||||
|
||||
public async Task<IEnumerable<Guid>?> GetUnitsIdByJobFilterAsync(Job job)
|
||||
{
|
||||
var result = new List<Guid>();
|
||||
|
||||
var baseQuery = unitService
|
||||
.Get().AsNoTracking()
|
||||
.Include(t => t.UnitValues)
|
||||
@@ -110,6 +119,8 @@ namespace PARR.DAL.DomainServices.Implementations
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async Task<IEnumerable<Guid>?> GetUnitsIdForExistTemplatesByJobFilterAsync(Guid jobId)
|
||||
{
|
||||
var unitIdsMustBeCreated = await GetUnitsIdByJobFilterAsync(jobId);
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace PARR.DAL.DomainServices.Interfaces
|
||||
using PARR.DAL.Models.Job;
|
||||
|
||||
namespace PARR.DAL.DomainServices.Interfaces
|
||||
{
|
||||
public interface IUnitFilterService
|
||||
{
|
||||
@@ -9,6 +11,8 @@
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<Guid>?> GetUnitsIdByJobFilterAsync(Guid jobId);
|
||||
|
||||
Task<IEnumerable<Guid>?> GetUnitsIdByJobFilterAsync(Job job);
|
||||
|
||||
/// <summary>
|
||||
/// Получить все Unit.Id, для которых не были созданы Template
|
||||
/// </summary>
|
||||
@@ -22,6 +26,6 @@
|
||||
/// <param name="jobId">Id работы</param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<Guid>?> GetUnitsIdForExistTemplatesByJobFilterAsync(Guid jobId);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user