From d4bad04103b9f27b20c29f66b3c5bc33a92563f0 Mon Sep 17 00:00:00 2001 From: ivanszabo Date: Mon, 3 Mar 2025 13:24:46 +0100 Subject: [PATCH] =?UTF-8?q?Ez=20is=20itt=20f=C3=A9lig=20k=C3=A9sz=20...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/CheckListController.cs | 114 ++++++++++++++++++ .../Services/CheckListService.cs | 12 ++ .../Services/Interfaces/ICheckListService.cs | 14 +++ .../DTO/CheckListHeaderDTO.cs | 18 +++ .../DTO/CheckListRowDTO.cs | 18 +++ .../Entities/CheckListHeader.cs | 1 + src/WorkFlowCheck.DL/Entities/CheckListRow.cs | 11 +- 7 files changed, 183 insertions(+), 5 deletions(-) create mode 100644 src/WorkFlowCheck.API/Controllers/CheckListController.cs create mode 100644 src/WorkFlowCheck.BL/Services/CheckListService.cs create mode 100644 src/WorkFlowCheck.BL/Services/Interfaces/ICheckListService.cs create mode 100644 src/WorkFlowCheck.Common/DTO/CheckListHeaderDTO.cs create mode 100644 src/WorkFlowCheck.Common/DTO/CheckListRowDTO.cs diff --git a/src/WorkFlowCheck.API/Controllers/CheckListController.cs b/src/WorkFlowCheck.API/Controllers/CheckListController.cs new file mode 100644 index 0000000..b078049 --- /dev/null +++ b/src/WorkFlowCheck.API/Controllers/CheckListController.cs @@ -0,0 +1,114 @@ +using Microsoft.AspNetCore.Mvc; +using WorkFlowCheck.BL.Services; +using WorkFlowCheck.BL.Services.Interfaces; +using WorkFlowCheck.Common.DTO; + +namespace WorkFlowCheck.API.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class CheckListController : ControllerBase + { + private ICheckListService _checkListService; + public CheckListController(ICheckListService checkListService) + { + _checkListService = checkListService; + } + + [HttpGet("GetCheckListHeader/{id}")] + public async Task> GetCheckListHeader() + { + var retVal = new ApiResponseDTO>() + { + IsSuccess = true, + }; + var checkPointListDTO = await _checkListService.GetAllCheckPointAsync(); + + if (checkPointListDTO != null) + { + + retVal.IsSuccess = true; + retVal.Data = checkPointListDTO; + } + else + { + retVal.IsSuccess = false; + retVal.Errors.Add("No data!"); + } + + return retVal; + } + + [HttpGet("GetAllEquipments")] + public async Task>> GetAllEquipmentsAsync() + { + var retVal = new ApiResponseDTO>() + { + IsSuccess = true, + }; + var equipmentListDTO = await _syncService.GetAllEquipmentAsync(); + + if (equipmentListDTO != null) + { + + retVal.IsSuccess = true; + retVal.Data = equipmentListDTO; + } + else + { + retVal.IsSuccess = false; + retVal.Errors.Add("No data!"); + } + + return retVal; + } + + [HttpGet("GetAllLocations")] + public async Task>> GetAllLocationsAsync() + { + var retVal = new ApiResponseDTO>() + { + IsSuccess = true, + }; + var locationListDTO = await _syncService.GetAllLocationAsync(); + + if (locationListDTO != null) + { + + retVal.IsSuccess = true; + retVal.Data = locationListDTO; + } + else + { + retVal.IsSuccess = false; + retVal.Errors.Add("No data!"); + } + + return retVal; + } + + [HttpGet("GetAllCheckListTemplateHeader")] + public async Task>> GetAllCheckListTemplateHeaderAsync() + { + 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/Services/CheckListService.cs b/src/WorkFlowCheck.BL/Services/CheckListService.cs new file mode 100644 index 0000000..94f21fd --- /dev/null +++ b/src/WorkFlowCheck.BL/Services/CheckListService.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WorkFlowCheck.BL.Services +{ + class CheckListService + { + } +} diff --git a/src/WorkFlowCheck.BL/Services/Interfaces/ICheckListService.cs b/src/WorkFlowCheck.BL/Services/Interfaces/ICheckListService.cs new file mode 100644 index 0000000..24c8e5a --- /dev/null +++ b/src/WorkFlowCheck.BL/Services/Interfaces/ICheckListService.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using WorkFlowCheck.Common.DTO; + +namespace WorkFlowCheck.BL.Services.Interfaces +{ + public interface ICheckListService + { + Task GetCheckListHeader(int Id); + } +} diff --git a/src/WorkFlowCheck.Common/DTO/CheckListHeaderDTO.cs b/src/WorkFlowCheck.Common/DTO/CheckListHeaderDTO.cs new file mode 100644 index 0000000..e4e64c4 --- /dev/null +++ b/src/WorkFlowCheck.Common/DTO/CheckListHeaderDTO.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WorkFlowCheck.Common.DTO +{ + public class CheckListHeaderDTO + { + public int Id { get; set; } + public string ShortName { get; set; } = null!; + public string Description { get; set; } = null!; + public string DocumentNumber { get; set; } = null!; + public Guid GuidNumber { get; set; } + public required ICollection CheckListRowDTO { get; set; } = new List(); + } +} diff --git a/src/WorkFlowCheck.Common/DTO/CheckListRowDTO.cs b/src/WorkFlowCheck.Common/DTO/CheckListRowDTO.cs new file mode 100644 index 0000000..80e4521 --- /dev/null +++ b/src/WorkFlowCheck.Common/DTO/CheckListRowDTO.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WorkFlowCheck.Common.DTO +{ + public class CheckListRowDTO + { + public int Id { get; set; } + public int CheckListHeaderId { get; set; } + public int CheckListTemplateRowId { get; set; } + public string Answer { get; set; } = null!; + public byte[] Photo { get; set; } = null!; + public Guid GuidNumber { get; set; } + } +} diff --git a/src/WorkFlowCheck.DL/Entities/CheckListHeader.cs b/src/WorkFlowCheck.DL/Entities/CheckListHeader.cs index 5dd1a4d..b9ef391 100644 --- a/src/WorkFlowCheck.DL/Entities/CheckListHeader.cs +++ b/src/WorkFlowCheck.DL/Entities/CheckListHeader.cs @@ -13,6 +13,7 @@ namespace WorkFlowCheck.DL.Entities public string ShortName { get; set; } = null!; public string Description { get; set; } = null!; public string DocumentNumber { get; set; } = null!; + public Guid GuidNumber { get; set; } public bool IsStorno { get; set; } public DateTime LastModAt { get; set; } public string LastModBy { get; set; } = null!; diff --git a/src/WorkFlowCheck.DL/Entities/CheckListRow.cs b/src/WorkFlowCheck.DL/Entities/CheckListRow.cs index 437a9a8..c3c7ca0 100644 --- a/src/WorkFlowCheck.DL/Entities/CheckListRow.cs +++ b/src/WorkFlowCheck.DL/Entities/CheckListRow.cs @@ -7,15 +7,16 @@ using WorkFlowCheck.DL.Interfaces; namespace WorkFlowCheck.DL.Entities { - public class CheckListRow:ISoftDeletableEntity, IAuditableEntity + public class CheckListRow : ISoftDeletableEntity, IAuditableEntity { - public int Id { get; set; } - public int CheckListHeaderId { get; set; } + public int Id { get; set; } + public int CheckListHeaderId { get; set; } public virtual CheckListHeader CheckListHeader { get; set; } = null!; - public int CheckListTemplateRowId { get; set; } + public int CheckListTemplateRowId { get; set; } public virtual CheckListTemplateRow CheckListTemplateRow { get; set; } = null!; - public string Answer { get; set; } = null!; + public string Answer { get; set; } = null!; public byte[] Photo { get; set; } = null!; + public Guid GuidNumber { get; set; } public DateTime LastModAt { get; set; } public string LastModBy { get; set; } = null!; public DateTime CreatedAt { get; set; }