feat(dal): ShortcodesService init
This commit is contained in:
13
PARR.DAL/DomainServices/IShortcodesService.cs
Normal file
13
PARR.DAL/DomainServices/IShortcodesService.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace PARR.DAL.DomainServices
|
||||||
|
{
|
||||||
|
public interface IShortcodesService
|
||||||
|
{
|
||||||
|
Task<string> ApplyShortcodesAsync(string str, Guid unitId, Guid jobId);
|
||||||
|
}
|
||||||
|
}
|
||||||
17
PARR.DAL/DomainServices/ShortcodesService.cs
Normal file
17
PARR.DAL/DomainServices/ShortcodesService.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace PARR.DAL.DomainServices
|
||||||
|
{
|
||||||
|
internal class ShortcodesService : IShortcodesService
|
||||||
|
{
|
||||||
|
public Task<string> ApplyShortcodesAsync(string str, Guid unitId, Guid jobId)
|
||||||
|
{
|
||||||
|
//TODO удалить старый в GeneralExtesions, связанные с ним Enum и написать метод. делов...
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,8 +29,8 @@ namespace PARR.DAL.DomainServices
|
|||||||
{
|
{
|
||||||
var nameConstants = settingsFromDb.TemplateNameConstantPartsList;
|
var nameConstants = settingsFromDb.TemplateNameConstantPartsList;
|
||||||
|
|
||||||
var job = await jobService.Get().FirstOrDefaultAsync(t => t.Id == jobId);
|
var job = await jobService.Get().AsNoTracking().FirstOrDefaultAsync(t => t.Id == jobId);
|
||||||
var unit = await unitService.Get().FirstOrDefaultAsync(t => t.Id == unitId);
|
var unit = await unitService.Get().AsNoTracking().FirstOrDefaultAsync(t => t.Id == unitId);
|
||||||
|
|
||||||
if (job != null && unit != null && job.TemplateNameMask != null)
|
if (job != null && unit != null && job.TemplateNameMask != null)
|
||||||
{
|
{
|
||||||
@@ -67,6 +67,7 @@ namespace PARR.DAL.DomainServices
|
|||||||
private async Task<string> ReplaceFieldValues(Guid unitId, string resultName, List<Match> shortcodesInMask)
|
private async Task<string> ReplaceFieldValues(Guid unitId, string resultName, List<Match> shortcodesInMask)
|
||||||
{
|
{
|
||||||
var unitWithFields = await unitService.Get()
|
var unitWithFields = await unitService.Get()
|
||||||
|
.AsNoTracking()
|
||||||
.Include(u => u.UnitValues)
|
.Include(u => u.UnitValues)
|
||||||
.ThenInclude(uv => uv.Field)
|
.ThenInclude(uv => uv.Field)
|
||||||
.Include(u => u.UnitValues)
|
.Include(u => u.UnitValues)
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ namespace PARR.DAL
|
|||||||
|
|
||||||
#region DomainServces
|
#region DomainServces
|
||||||
services.AddTransient<ITemplateNameGeneratorService, TemplateNameGeneratorService>();
|
services.AddTransient<ITemplateNameGeneratorService, TemplateNameGeneratorService>();
|
||||||
|
services.AddTransient<IShortcodesService, ShortcodesService>();
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user