API és endpoint kiegészítése

This commit is contained in:
2025-02-19 15:49:53 +01:00
parent 2ae985c6e0
commit 790f92a940
7 changed files with 88 additions and 14 deletions
@@ -14,6 +14,7 @@ namespace WorkFlowCheck.API.Controllers
{
_syncService = syncService;
}
[HttpGet("GetAllCheckPoints")]
public async Task<ApiResponseDTO<CheckPointListDTO>> GetAllCheckpoint()
{
@@ -21,7 +22,7 @@ namespace WorkFlowCheck.API.Controllers
{
IsSuccess = true,
};
var checkPointListDTO = await _syncService.GetAllCheckPoint();
var checkPointListDTO = await _syncService.GetAllCheckPointAsync();
if (checkPointListDTO != null)
{
@@ -37,5 +38,29 @@ namespace WorkFlowCheck.API.Controllers
return retVal;
}
[HttpGet("GetAllCheckListHeader")]
public async Task<ApiResponseDTO<List<CheckListTemplateHeaderDTO>>> GetAllCheckListHeader()
{
var retVal = new ApiResponseDTO<List<CheckListTemplateHeaderDTO>>()
{
IsSuccess = true,
};
var response = await _syncService.GetAllCheckListTemplateAsync();
if (response != null)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
}
}
@@ -19,7 +19,9 @@ namespace WorkFlowCheck.BL.Mappings
.ForMember(dest => dest.PasswordHash, opt => opt.MapFrom<PasswordHashResolver>());
CreateMap<CheckListTemplateHeader, CheckListTemplateHeaderDTO>();
CreateMap<CheckListTemplateHeader, CheckListTemplateHeaderDTO>()
.ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRows));
CreateMap<CheckListTemplateRow, CheckListTemplateRowDTO>();
CreateMap<CheckPoint, CheckPointDTO>();
}
}
@@ -5,6 +5,7 @@ namespace WorkFlowCheck.BL.Services.Interfaces
{
public interface ISyncService
{
Task<CheckPointListDTO> GetAllCheckPoint();
Task<CheckPointListDTO> GetAllCheckPointAsync();
Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateAsync();
}
}
+22 -1
View File
@@ -20,7 +20,7 @@ namespace WorkFlowCheck.BL.Services
_mapper = mapper;
}
public async Task<CheckPointListDTO> GetAllCheckPoint()
public async Task<CheckPointListDTO> GetAllCheckPointAsync()
{
var retVal = new CheckPointListDTO();
@@ -39,6 +39,27 @@ namespace WorkFlowCheck.BL.Services
return retVal;
}
public async Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateAsync()
{
var retVal = new List<CheckListTemplateHeaderDTO>();
try
{
var res = await _dbContext.CheckListTemplateHeaders.Include(i => i.CheckListTemplateRows).AsNoTracking().ToListAsync();
if (res != null)
{
retVal = _mapper.Map<List<CheckListTemplateHeaderDTO>>(res);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<CheckPointListDTO> GetAllLocation()
{
var retVal = new CheckPointListDTO();
@@ -7,5 +7,7 @@ namespace WorkFlowCheck.Common.DTO
public int Id { get; set; }
public string ShortName { get; set; } = null!;
public string Description { get; set; } = null!;
public required ICollection<CheckListTemplateRowDTO> CheckListTemplateRowDTO { get; set; } = new List<CheckListTemplateRowDTO>();
}
}
@@ -5,7 +5,27 @@ namespace WorkFlowCheck.Common.DTO
public class CheckListTemplateRowDTO
{
public int Id { get; set; }
public string ShortName { get; set; } = null!;
public string Description { get; set; } = null!;
public int RowIndex { get; set; }
public int CheckListTemplateHeaderId { get; set; }
public int EquipmentId { get; set; }
public int CheckPointId { get; set; }
public string OperationDescription { get; set; } = null!;
/// <summary>
///
/// I-N (Igen, nem)
/// P (Fénykép készítése)
/// SI-N (Sárga igen,fehér nem)
/// I-SN (Fehér igen, sárga nem)
/// PI-N (Piros igen,fehér nem)
/// I-PN (Fehér igen, piros nem)
///
/// </summary>
public string AnswerType { get; set; } = null!;
}
}
@@ -1,5 +1,4 @@
using System.ComponentModel.DataAnnotations.Schema;
using WorkFlowCheck.DL.Interfaces;
using WorkFlowCheck.DL.Interfaces;
namespace WorkFlowCheck.DL.Entities
{
@@ -13,5 +12,9 @@ namespace WorkFlowCheck.DL.Entities
public string LastModBy { get; set; } = null!;
public DateTime CreatedAt { get; set; }
public string CreatedBy { get; set; } = null!;
public virtual ICollection<CheckListTemplateRow> CheckListTemplateRows { get; set; } = new List<CheckListTemplateRow>();
}
}