fix(esppSync, dal, api): Исправление после удаления старых ShortCodes
This commit is contained in:
@@ -3,9 +3,7 @@ using PARR.API.Authentication.Models;
|
||||
using PARR.API.Contracts.V1.Responses;
|
||||
using PARR.API.MappingProfiles.Resolvers;
|
||||
using PARR.Common.Domain;
|
||||
using PARR.Constants.Shortcodes;
|
||||
using PARR.DAL.DomainModels;
|
||||
using PARR.DAL.Extensions;
|
||||
using PARR.DAL.Models;
|
||||
using PARR.DAL.Models.Job;
|
||||
using PARR.DAL.Models.Unit;
|
||||
@@ -158,11 +156,11 @@ namespace PARR.API.MappingProfiles
|
||||
.ForMember(d => d.IsActive, o => o.MapFrom(s => s.Template!.IsActiveTemplate))
|
||||
.ForMember(d => d.ClosingCode, o => o.MapFrom<RobotTaskTemplateClosingCodeResolver>())
|
||||
.ForMember(d => d.FullDescription, o => o.MapFrom(s => s.Template!.Job!.Group!.FullDescription))
|
||||
.ForMember(d => d.ShortDescription, o => o.MapFrom(s => s.Template!.Job!.Group!.ShortDescription.ApplyShortcode(ShortcodeEnum.EK, s.Template!.Unit!.Name)))
|
||||
.ForMember(d => d.ShortDescription, o => o.MapFrom(s => s.Template!.Job!.Group!.ShortDescription))
|
||||
.ForMember(d => d.Solution, o => o.MapFrom(s => s.Template!.Job!.Group!.Solution))
|
||||
//.ForMember(d => d.ResponseArea, o => o.MapFrom(s => s.Template!.Host!.ResponseArea!.Name))
|
||||
//ЗО берем у группы а не у хоста
|
||||
.ForMember(d => d.ResponseArea, o => o.MapFrom(s => s.Template!.Unit.BaseFields.ResponseArea))
|
||||
.ForMember(d => d.ResponseArea, o => o.MapFrom(s => s.Template!.Unit.BaseFields!.ResponseArea))
|
||||
.ForMember(d => d.TemplateDuration, o => o.MapFrom(s => s.Template!.Job!.Group!.TemplateDuration))
|
||||
.ForMember(d => d.Initiator, o => o.MapFrom<RobotTaskTemplateInitiatorResolver>())
|
||||
.ForMember(d => d.Category, o => o.MapFrom<RobotTaskTemplateCategoryResolver>())
|
||||
@@ -173,9 +171,9 @@ namespace PARR.API.MappingProfiles
|
||||
.ForMember(d => d.ProcessEsppId, o => o.MapFrom(s => s.Template!.Job!.Tnk!.Subprocess!.Process!.EsppId))
|
||||
.ForMember(d => d.SubprocessName, o => o.MapFrom(s => s.Template!.Job!.Tnk!.Subprocess!.Name))
|
||||
.ForMember(d => d.SubprocessEsppId, o => o.MapFrom(s => s.Template!.Job!.Tnk!.Subprocess!.EsppId))
|
||||
.ForMember(d => d.TnkName, o => o.MapFrom(s => s.Template!.Job!.Tnk!.Name.ApplyShortcode(ShortcodeEnum.EK, s.Template!.Unit!.Name)))
|
||||
.ForMember(d => d.TnkName, o => o.MapFrom(s => s.Template!.Job!.Tnk!.Name))
|
||||
.ForMember(d => d.TnkEsppId, o => o.MapFrom(s => s.Template!.Job!.Tnk!.EsppId))
|
||||
.ForMember(d => d.WorkName, o => o.MapFrom(s => s.Template!.Job!.WorkName.ApplyShortcode(ShortcodeEnum.EK, s.Template!.Unit!.Name)))
|
||||
.ForMember(d => d.WorkName, o => o.MapFrom(s => s.Template!.Job!.WorkName))
|
||||
//.ForMember(d => d.WorkEsppId, o => o.MapFrom(s => s.Template!.Job!.EsppId))
|
||||
.ForMember(d => d.ScheduleEsppId, o => o.MapFrom(s => s.Template!.ScheduleEsppId));
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using AutoMapper;
|
||||
using PARR.API.Contracts.V1.Responses;
|
||||
using PARR.DAL.DomainServices;
|
||||
using PARR.DAL.Models;
|
||||
|
||||
namespace PARR.API.MappingProfiles.Resolvers
|
||||
{
|
||||
public class RobotTaskTemplateShortCodeResolver : IValueResolver<RobotConfiguration, RobotTaskTemplateResponse, string>
|
||||
{
|
||||
private readonly IShortcodesService shortcodesService;
|
||||
|
||||
public RobotTaskTemplateShortCodeResolver(
|
||||
IShortcodesService shortcodesService
|
||||
)
|
||||
{
|
||||
this.shortcodesService = shortcodesService;
|
||||
}
|
||||
public string Resolve(RobotConfiguration source, RobotTaskTemplateResponse destination, string destMember, ResolutionContext context)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
using FluentValidation;
|
||||
using PARR.API.Contracts.V1.Requests;
|
||||
using PARR.BLL.Services.Interfaces;
|
||||
using PARR.Constants.Shortcodes;
|
||||
using PARR.DAL.Services.Interfaces;
|
||||
|
||||
namespace PARR.API.Validators
|
||||
@@ -24,15 +23,16 @@ namespace PARR.API.Validators
|
||||
RuleFor(t => t.TemplateNameMask)
|
||||
.NotEmpty()
|
||||
.NotNull();
|
||||
|
||||
RuleFor(t => t.TemplateNameMask)
|
||||
.Must((entity, value, c) => templateMaskValidator
|
||||
.IsValid(entity.TemplateNameMask))
|
||||
.WithMessage($"Неверно указана маска имени шаблонов. Обязательными условиями являются" +
|
||||
$" наличие кодового слова \"ПАРР\" и обязательное использование динамической составляющей" +
|
||||
$" %ЭК%. Доступные значения динамических составляющих:" +
|
||||
$" {string.Join(", ", Shortcodes.GetAll().Select(sc => sc.Name + " - " + sc.Description))}"
|
||||
);
|
||||
|
||||
//TODO Сделать проверку по шорткодам и возможным полям
|
||||
//RuleFor(t => t.TemplateNameMask)
|
||||
// .Must((entity, value, c) => templateMaskValidator
|
||||
// .IsValid(entity.TemplateNameMask))
|
||||
// .WithMessage($"Неверно указана маска имени шаблонов. Обязательными условиями являются" +
|
||||
// $" наличие кодового слова \"ПАРР\" и обязательное использование динамической составляющей" +
|
||||
// $" %ЭК%. Доступные значения динамических составляющих:" +
|
||||
// $" {string.Join(", ", Shortcodes.GetAll().Select(sc => sc.Name + " - " + sc.Description))}"
|
||||
// );
|
||||
|
||||
RuleFor(t => t.EsppId).NotEmpty().NotNull().WithMessage("EsppId не может быть пустым");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user