feat(dal): ShortcodesService init

This commit is contained in:
Mikhail Kuznetsov
2025-08-01 09:02:01 +10:00
parent 5bbf2e2db5
commit 093d2fc090
4 changed files with 34 additions and 2 deletions

View 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);
}
}

View 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();
}
}
}

View File

@@ -29,8 +29,8 @@ namespace PARR.DAL.DomainServices
{
var nameConstants = settingsFromDb.TemplateNameConstantPartsList;
var job = await jobService.Get().FirstOrDefaultAsync(t => t.Id == jobId);
var unit = await unitService.Get().FirstOrDefaultAsync(t => t.Id == unitId);
var job = await jobService.Get().AsNoTracking().FirstOrDefaultAsync(t => t.Id == jobId);
var unit = await unitService.Get().AsNoTracking().FirstOrDefaultAsync(t => t.Id == unitId);
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)
{
var unitWithFields = await unitService.Get()
.AsNoTracking()
.Include(u => u.UnitValues)
.ThenInclude(uv => uv.Field)
.Include(u => u.UnitValues)

View File

@@ -118,6 +118,7 @@ namespace PARR.DAL
#region DomainServces
services.AddTransient<ITemplateNameGeneratorService, TemplateNameGeneratorService>();
services.AddTransient<IShortcodesService, ShortcodesService>();
#endregion
}