diff --git a/src/WorkFlowCheck.API/Controllers/SyncController.cs b/src/WorkFlowCheck.API/Controllers/SyncController.cs index ff41d88..f30248e 100644 --- a/src/WorkFlowCheck.API/Controllers/SyncController.cs +++ b/src/WorkFlowCheck.API/Controllers/SyncController.cs @@ -14,6 +14,7 @@ namespace WorkFlowCheck.API.Controllers { _syncService = syncService; } + [HttpGet("GetAllCheckPoints")] public async Task> 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>> GetAllCheckListHeader() + { + var retVal = new ApiResponseDTO>() + { + 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; + } } } diff --git a/src/WorkFlowCheck.BL/Mappings/MapperProfile.cs b/src/WorkFlowCheck.BL/Mappings/MapperProfile.cs index 0fc0967..190c971 100644 --- a/src/WorkFlowCheck.BL/Mappings/MapperProfile.cs +++ b/src/WorkFlowCheck.BL/Mappings/MapperProfile.cs @@ -19,7 +19,9 @@ namespace WorkFlowCheck.BL.Mappings .ForMember(dest => dest.PasswordHash, opt => opt.MapFrom()); - CreateMap(); + CreateMap() + .ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRows)); + CreateMap(); CreateMap(); } } diff --git a/src/WorkFlowCheck.BL/Services/Interfaces/ISyncService.cs b/src/WorkFlowCheck.BL/Services/Interfaces/ISyncService.cs index 4923f64..fb929bb 100644 --- a/src/WorkFlowCheck.BL/Services/Interfaces/ISyncService.cs +++ b/src/WorkFlowCheck.BL/Services/Interfaces/ISyncService.cs @@ -5,6 +5,7 @@ namespace WorkFlowCheck.BL.Services.Interfaces { public interface ISyncService { - Task GetAllCheckPoint(); + Task GetAllCheckPointAsync(); + Task> GetAllCheckListTemplateAsync(); } } diff --git a/src/WorkFlowCheck.BL/Services/SyncService.cs b/src/WorkFlowCheck.BL/Services/SyncService.cs index 41d7341..04c7d08 100644 --- a/src/WorkFlowCheck.BL/Services/SyncService.cs +++ b/src/WorkFlowCheck.BL/Services/SyncService.cs @@ -20,7 +20,7 @@ namespace WorkFlowCheck.BL.Services _mapper = mapper; } - public async Task GetAllCheckPoint() + public async Task GetAllCheckPointAsync() { var retVal = new CheckPointListDTO(); @@ -39,6 +39,27 @@ namespace WorkFlowCheck.BL.Services return retVal; } + public async Task> GetAllCheckListTemplateAsync() + { + var retVal = new List(); + + try + { + var res = await _dbContext.CheckListTemplateHeaders.Include(i => i.CheckListTemplateRows).AsNoTracking().ToListAsync(); + + if (res != null) + { + retVal = _mapper.Map>(res); + + } + } + catch (Exception ex) + { + Log.Error(ex.Message); + } + + return retVal; + } public async Task GetAllLocation() { var retVal = new CheckPointListDTO(); diff --git a/src/WorkFlowCheck.Common/DTO/CheckListTemplateHeaderDTO.cs b/src/WorkFlowCheck.Common/DTO/CheckListTemplateHeaderDTO.cs index dad0325..134897e 100644 --- a/src/WorkFlowCheck.Common/DTO/CheckListTemplateHeaderDTO.cs +++ b/src/WorkFlowCheck.Common/DTO/CheckListTemplateHeaderDTO.cs @@ -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 { get; set; } = new List(); } } diff --git a/src/WorkFlowCheck.Common/DTO/CheckListTemplateRowDTO.cs b/src/WorkFlowCheck.Common/DTO/CheckListTemplateRowDTO.cs index 27e65c6..ded6dd3 100644 --- a/src/WorkFlowCheck.Common/DTO/CheckListTemplateRowDTO.cs +++ b/src/WorkFlowCheck.Common/DTO/CheckListTemplateRowDTO.cs @@ -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!; + + /// + /// + /// 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) + /// + /// + public string AnswerType { get; set; } = null!; + + } } diff --git a/src/WorkFlowCheck.DL/Entities/CheckListTemplateHeader.cs b/src/WorkFlowCheck.DL/Entities/CheckListTemplateHeader.cs index 2938b50..3095e76 100644 --- a/src/WorkFlowCheck.DL/Entities/CheckListTemplateHeader.cs +++ b/src/WorkFlowCheck.DL/Entities/CheckListTemplateHeader.cs @@ -1,17 +1,20 @@ -using System.ComponentModel.DataAnnotations.Schema; -using WorkFlowCheck.DL.Interfaces; +using WorkFlowCheck.DL.Interfaces; namespace WorkFlowCheck.DL.Entities { - public class CheckListTemplateHeader:ISoftDeletableEntity,IAuditableEntity + public class CheckListTemplateHeader : ISoftDeletableEntity, IAuditableEntity { public int Id { get; set; } public string ShortName { get; set; } = null!; public string Description { get; set; } = null!; - public bool IsDeleted { get ; set ; } - public DateTime LastModAt { get ; set ; } - public string LastModBy { get ; set ; } = null!; - public DateTime CreatedAt { get ; set ; } - public string CreatedBy { get ; set ; } = null!; + public bool IsDeleted { get; set; } + public DateTime LastModAt { get; set; } + public string LastModBy { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public string CreatedBy { get; set; } = null!; + + public virtual ICollection CheckListTemplateRows { get; set; } = new List(); + + } }