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; _syncService = syncService;
} }
[HttpGet("GetAllCheckPoints")] [HttpGet("GetAllCheckPoints")]
public async Task<ApiResponseDTO<CheckPointListDTO>> GetAllCheckpoint() public async Task<ApiResponseDTO<CheckPointListDTO>> GetAllCheckpoint()
{ {
@@ -21,7 +22,7 @@ namespace WorkFlowCheck.API.Controllers
{ {
IsSuccess = true, IsSuccess = true,
}; };
var checkPointListDTO = await _syncService.GetAllCheckPoint(); var checkPointListDTO = await _syncService.GetAllCheckPointAsync();
if (checkPointListDTO != null) if (checkPointListDTO != null)
{ {
@@ -37,5 +38,29 @@ namespace WorkFlowCheck.API.Controllers
return retVal; 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>()); .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>(); CreateMap<CheckPoint, CheckPointDTO>();
} }
} }
@@ -5,6 +5,7 @@ namespace WorkFlowCheck.BL.Services.Interfaces
{ {
public interface ISyncService 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; _mapper = mapper;
} }
public async Task<CheckPointListDTO> GetAllCheckPoint() public async Task<CheckPointListDTO> GetAllCheckPointAsync()
{ {
var retVal = new CheckPointListDTO(); var retVal = new CheckPointListDTO();
@@ -39,6 +39,27 @@ namespace WorkFlowCheck.BL.Services
return retVal; 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() public async Task<CheckPointListDTO> GetAllLocation()
{ {
var retVal = new CheckPointListDTO(); var retVal = new CheckPointListDTO();
@@ -7,5 +7,7 @@ namespace WorkFlowCheck.Common.DTO
public int Id { get; set; } public int Id { get; set; }
public string ShortName { get; set; } = null!; public string ShortName { get; set; } = null!;
public string Description { 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 class CheckListTemplateRowDTO
{ {
public int Id { get; set; } public int Id { get; set; }
public string ShortName { get; set; } = null!; public int RowIndex { get; set; }
public string Description { get; set; } = null!; 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,17 +1,20 @@
using System.ComponentModel.DataAnnotations.Schema; using WorkFlowCheck.DL.Interfaces;
using WorkFlowCheck.DL.Interfaces;
namespace WorkFlowCheck.DL.Entities namespace WorkFlowCheck.DL.Entities
{ {
public class CheckListTemplateHeader:ISoftDeletableEntity,IAuditableEntity public class CheckListTemplateHeader : ISoftDeletableEntity, IAuditableEntity
{ {
public int Id { get; set; } public int Id { get; set; }
public string ShortName { get; set; } = null!; public string ShortName { get; set; } = null!;
public string Description { get; set; } = null!; public string Description { get; set; } = null!;
public bool IsDeleted { get ; set ; } public bool IsDeleted { get; set; }
public DateTime LastModAt { get ; set ; } public DateTime LastModAt { get; set; }
public string LastModBy { get ; set ; } = null!; public string LastModBy { get; set; } = null!;
public DateTime CreatedAt { get ; set ; } public DateTime CreatedAt { get; set; }
public string CreatedBy { get ; set ; } = null!; public string CreatedBy { get; set; } = null!;
public virtual ICollection<CheckListTemplateRow> CheckListTemplateRows { get; set; } = new List<CheckListTemplateRow>();
} }
} }