From 0b70016ab6e569fab4594e94498402d780066b93 Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 21 Jul 2025 10:14:11 +0200 Subject: [PATCH] =?UTF-8?q?refactor(controller):=20ProfileController=20ver?= =?UTF-8?q?einfacht=20und=20Standardprofil-Antwort=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Basisklasse CRUDControllerBaseWithErrorHandling entfernt - Statisches Standard-Profilobjekt für Test-/Demo-Zwecke eingeführt - Generisches CRUD-Verhalten durch einfachen GET-Endpunkt ersetzt - Fehlerbehandlung mit Logging und HTTP-500-Antwort verbessert --- .../Controllers/ProfileController.cs | 40 ++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/src/WorkFlow.API/Controllers/ProfileController.cs b/src/WorkFlow.API/Controllers/ProfileController.cs index a888fa2..737ff20 100644 --- a/src/WorkFlow.API/Controllers/ProfileController.cs +++ b/src/WorkFlow.API/Controllers/ProfileController.cs @@ -1,9 +1,7 @@ -using DigitalData.Core.API; -using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using WorkFlow.API.Attributes; using WorkFlow.Application.Contracts; -using WorkFlow.Application.DTO.Profile; using WorkFlow.Domain.Entities; namespace WorkFlow.API.Controllers; @@ -12,9 +10,41 @@ namespace WorkFlow.API.Controllers; [Route("api/[controller]")] [ApiController] [Authorize] -public class ProfileController : CRUDControllerBaseWithErrorHandling +public class ProfileController : ControllerBase { - public ProfileController(ILogger logger, IProfileService service) : base(logger, service) + public static readonly Profile Default = new () { + Id = 1, + TypeId = 1, + Caption = "VA Freigabe", + Subtitle = "Freigabe in Rolle Verantwortlich", + CountObj = 2, + ForeColor = "Yellow", + BackColor = "Black" + }; + + private readonly ILogger _logger; + + private readonly IProfileService _service; + public ProfileController(ILogger logger, IProfileService service) + { + _logger = logger; + _service = service; } + + [HttpGet] + [Authorize] + public IActionResult GetAsync() + { + try + { + return Ok(Default); + } + catch (Exception ex) + { + _logger.LogError(ex, "{Message}", ex.Message); + return StatusCode(500); + } + } + } \ No newline at end of file