feat(api): TemplateController адаптировал метод getAll под новую структуру
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
{
|
||||
public class TemplateQuery
|
||||
{
|
||||
/// <summary>
|
||||
/// Статус шаблона: 10, 20, 30
|
||||
/// </summary>
|
||||
public int? StatusCode { get; set; }
|
||||
///// <summary>
|
||||
///// Статус шаблона: 10, 20, 30
|
||||
///// </summary>
|
||||
//public int? StatusCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Поиск по маске. Например: "*-ДВС"
|
||||
|
||||
@@ -4,24 +4,18 @@
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public required string Name { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
public bool IsActiveTemplate { get; set; }
|
||||
public bool IsActiveSchedule { get; set; }
|
||||
|
||||
public required string Category { get; set; }
|
||||
public required string Initiator { get; set; }
|
||||
public required string ClosingCode { get; set; }
|
||||
|
||||
public int StatusCode { get; set; }
|
||||
|
||||
public required string ShortDescription { get; set; }
|
||||
public required string FullDescription { get; set; }
|
||||
public required string Solution { get; set; }
|
||||
public required string TemplateDuration { get; set; }
|
||||
|
||||
public int RobotAttemptsNumber { get; set; }
|
||||
public DateTimeOffset? RobotLastStatusUpdated { get; set; }
|
||||
public RobotStatusResponse? RobotStatus { get; set; }
|
||||
|
||||
|
||||
//work
|
||||
//public required string Title { get; set; }
|
||||
//public required string SlaInterval { get; set; }
|
||||
@@ -48,37 +42,39 @@
|
||||
//tnk
|
||||
//public required string RzdMTNKtnk { get; set; }
|
||||
public TnkResponse? Tnk { get; set; }
|
||||
|
||||
public List<RobotConfigurationResponse>? SyncStatus { get; set; }
|
||||
}
|
||||
|
||||
public class TemplateStringResponse
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
public required string IsActive { get; set; }
|
||||
public required string Assignment { get; set; }
|
||||
public required string Title { get; set; }
|
||||
public required string Category { get; set; }
|
||||
public required string Branch { get; set; }
|
||||
public required string SlaInterval { get; set; }
|
||||
public required string ConfigurationItem { get; set; }
|
||||
public required string ContactName { get; set; }
|
||||
public required string Description { get; set; }
|
||||
public required string ResolutionCode { get; set; }
|
||||
public required string Resolution { get; set; }
|
||||
//public class TemplateStringResponse
|
||||
//{
|
||||
// public required string Name { get; set; }
|
||||
// public required string IsActive { get; set; }
|
||||
// public required string Assignment { get; set; }
|
||||
// public required string Title { get; set; }
|
||||
// public required string Category { get; set; }
|
||||
// public required string Branch { get; set; }
|
||||
// public required string SlaInterval { get; set; }
|
||||
// public required string ConfigurationItem { get; set; }
|
||||
// public required string ContactName { get; set; }
|
||||
// public required string Description { get; set; }
|
||||
// public required string ResolutionCode { get; set; }
|
||||
// public required string Resolution { get; set; }
|
||||
|
||||
public required string RzdMTNKprocess { get; set; }
|
||||
public required string RzdMTNKprocessId { get; set; }
|
||||
// public required string RzdMTNKprocess { get; set; }
|
||||
// public required string RzdMTNKprocessId { get; set; }
|
||||
|
||||
public required string RzdMTNKsubprocess { get; set; }
|
||||
public required string RzdMTNKsubprocessId { get; set; }
|
||||
// public required string RzdMTNKsubprocess { get; set; }
|
||||
// public required string RzdMTNKsubprocessId { get; set; }
|
||||
|
||||
public required string RzdMTNKtnk { get; set; }
|
||||
public required string RzdMTNKtnkId { get; set; }
|
||||
// public required string RzdMTNKtnk { get; set; }
|
||||
// public required string RzdMTNKtnkId { get; set; }
|
||||
|
||||
public required string RzdMTNKjob { get; set; }
|
||||
public required string RzdMTNKjobId { get; set; }
|
||||
// public required string RzdMTNKjob { get; set; }
|
||||
// public required string RzdMTNKjobId { get; set; }
|
||||
|
||||
|
||||
public required string Id { get; set; }
|
||||
public required string StatusCode { get; set; }
|
||||
}
|
||||
// public required string Id { get; set; }
|
||||
// public required string StatusCode { get; set; }
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace PARR.API.Controllers.V1
|
||||
|
||||
var configToResonse = await robotConfigurationService.Get()
|
||||
.Include(t => t.Robot)
|
||||
.Include(t => t.StatusTask)
|
||||
.Include(t => t.TaskStatus)
|
||||
.Include(t => t.RobotStatus)
|
||||
.FirstOrDefaultAsync(t => t.Id == taskId);
|
||||
|
||||
|
||||
@@ -44,28 +44,12 @@ namespace PARR.API.Controllers.V1
|
||||
var paginationFilter = mapper.Map<PaginationFilter>(paginationQuery);
|
||||
|
||||
IQueryable<Template> query = templateService.GetWithIncludes()
|
||||
.Include(t => t.RobotConfigurations).ThenInclude(t=>t.Robot)
|
||||
.Include(t => t.RobotConfigurations).ThenInclude(t => t.TaskStatus)
|
||||
.Include(t => t.RobotConfigurations).ThenInclude(t => t.RobotStatus)
|
||||
.OrderBy(t => t.Name)
|
||||
.AsSplitQuery();
|
||||
|
||||
//TODO:!!!
|
||||
|
||||
//if (filter.StatusCode.HasValue)
|
||||
//{
|
||||
// switch (filter.StatusCode.Value)
|
||||
// {
|
||||
// case (int)TaskStatusEnum.Ok:
|
||||
// query = query.Where(t => t.StatusCode == (int)TaskStatusEnum.Ok);
|
||||
// break;
|
||||
// case (int)TaskStatusEnum.Creating:
|
||||
// query = query.Where(t => t.StatusCode == (int)TaskStatusEnum.Creating);
|
||||
// break;
|
||||
// case (int)TaskStatusEnum.Updating:
|
||||
// query = query.Where(t => t.StatusCode == (int)TaskStatusEnum.Updating);
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
|
||||
if (!string.IsNullOrEmpty(filter.Mask))
|
||||
query = query.Where(t => EF.Functions.Like(t.Name.ToLower(), SqlHelpers.RegexToLike(filter.Mask)));
|
||||
|
||||
@@ -40,27 +40,8 @@ namespace PARR.API.MappingProfiles
|
||||
.ForMember(d => d.TemplateDuration, o => o.MapFrom(s => s.ApplicationsInWork!.TemplateDuration))
|
||||
.ForMember(d => d.Initiator, o => o.MapFrom<TemplateInitiatorResolver>())
|
||||
.ForMember(d => d.ClosingCode, o => o.MapFrom<TemplateClosingCodeResolver>())
|
||||
.ForMember(d => d.Category, o => o.MapFrom<TemplateCategoryResolver>());
|
||||
|
||||
CreateMap<TemplateResponse, TemplateStringResponse>()
|
||||
.ForMember(d => d.Assignment, o => o.MapFrom(s => s.Host!.WorkGroup))
|
||||
.ForMember(d => d.Title, o => o.MapFrom(s => s.ShortDescription))
|
||||
.ForMember(d => d.Branch, o => o.MapFrom(s => s.Host!.ResponseArea))
|
||||
.ForMember(d => d.SlaInterval, o => o.MapFrom(s => s.TemplateDuration))
|
||||
.ForMember(d => d.ConfigurationItem, o => o.MapFrom(s => s.Host!.Ek))
|
||||
.ForMember(d => d.ContactName, o => o.MapFrom(s => s.Initiator))
|
||||
.ForMember(d => d.Description, o => o.MapFrom(s => s.FullDescription))
|
||||
.ForMember(d => d.ResolutionCode, o => o.MapFrom(s => s.ClosingCode))
|
||||
.ForMember(d => d.Resolution, o => o.MapFrom(s => s.Solution))
|
||||
.ForMember(d => d.RzdMTNKprocess, o => o.MapFrom(s => s.Process!.Name))
|
||||
.ForMember(d => d.RzdMTNKprocessId, o => o.MapFrom(s => s.Process!.EsppId))
|
||||
.ForMember(d => d.RzdMTNKsubprocess, o => o.MapFrom(s => s.Subprocess!.Name))
|
||||
.ForMember(d => d.RzdMTNKsubprocessId, o => o.MapFrom(s => s.Subprocess!.EsppId))
|
||||
.ForMember(d => d.RzdMTNKtnk, o => o.MapFrom(s => s.Tnk!.Name))
|
||||
.ForMember(d => d.RzdMTNKtnkId, o => o.MapFrom(s => s.Tnk!.EsppId))
|
||||
.ForMember(d => d.RzdMTNKjob, o => o.MapFrom(s => s.Work!.Name))
|
||||
.ForMember(d => d.RzdMTNKjobId, o => o.MapFrom(s => s.Work!.EsppId));
|
||||
|
||||
.ForMember(d => d.Category, o => o.MapFrom<TemplateCategoryResolver>())
|
||||
.ForMember(d => d.SyncStatus, o => o.MapFrom(s => s.RobotConfigurations));
|
||||
// === Template ===
|
||||
|
||||
CreateMap<DAL.Models.TaskStatus, TaskStatusResponse>();
|
||||
@@ -123,7 +104,7 @@ namespace PARR.API.MappingProfiles
|
||||
|
||||
CreateMap<RobotConfiguration, RobotConfigurationResponse>()
|
||||
.ForMember(d => d.Robot, o => o.MapFrom(s => s.Robot))
|
||||
.ForMember(d => d.TaskStatus, o => o.MapFrom(s => s.StatusTask))
|
||||
.ForMember(d => d.TaskStatus, o => o.MapFrom(s => s.TaskStatus))
|
||||
.ForMember(d => d.RobotStatus, o => o.MapFrom(s => s.RobotStatus));
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user