Compare commits

...

4 Commits

Author SHA1 Message Date
a954a24888 feat(Controller): Nicht erforderliche Post-, Put- und Delete-Methoden ignorieren 2025-07-23 16:20:46 +02:00
a78c117a47 feat: extend default Profile with sample ProfileObjects
- Added two sample `ProfileObject` instances to the static `Default` Profile
- Includes object metadata like ObjStateId, ObjectId, headlines, and sublines
- Enhances the default response of `GET /api/profile` for testing/demo purposes
2025-07-21 10:24:43 +02:00
07e16f8aca feat(domain): ProfileObject-Entität zur Repräsentation von Objekt-Metadaten hinzugefügt
ProfileObject-Klasse zu WorkFlow.Domain.Entities hinzugefügt mit folgenden Eigenschaften:
- ObjStateId
- ObjectId
- Headline1, Headline2
- Subline1, Subline2
- CmdCheckIn
2025-07-21 10:18:57 +02:00
0b70016ab6 refactor(controller): ProfileController vereinfacht und Standardprofil-Antwort hinzugefügt
- 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
2025-07-21 10:14:11 +02:00
7 changed files with 118 additions and 6 deletions

View File

@ -17,4 +17,22 @@ public class ConfigController : CRUDControllerBaseWithErrorHandling<IConfigServi
public ConfigController(ILogger<ConfigController> logger, IConfigService service) : base(logger, service)
{
}
[NonAction]
public override Task<IActionResult> Create(ConfigCreateDto createDto)
{
return base.Create(createDto);
}
[NonAction]
public override Task<IActionResult> Update(ConfigUpdateDto updateDto)
{
return base.Update(updateDto);
}
[NonAction]
public override Task<IActionResult> Delete([FromRoute] int id)
{
return base.Delete(id);
}
}

View File

@ -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,64 @@ namespace WorkFlow.API.Controllers;
[Route("api/[controller]")]
[ApiController]
[Authorize]
public class ProfileController : CRUDControllerBaseWithErrorHandling<IProfileService, ProfileCreateDto, ProfileDto, ProfileUpdateDto, Profile, int>
public class ProfileController : ControllerBase
{
public ProfileController(ILogger<ProfileController> 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",
Objects = new ProfileObject[]
{
new()
{
ObjStateId = 3,
ObjectId = 21601,
Headline1 = "Aveco Holding",
Headline2 = "Digital Data",
Subline1 = null,
Subline2 = "25 4711",
CmdCheckIn = ""
},
new()
{
ObjStateId = 4,
ObjectId = 21600,
Headline1 = "Aveco",
Headline2 = "Hammer AF",
Subline1 = null,
Subline2 = "456875",
CmdCheckIn = ""
}
}
};
private readonly ILogger<ProfileController> _logger;
private readonly IProfileService _service;
public ProfileController(ILogger<ProfileController> 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);
}
}
}

View File

@ -65,6 +65,7 @@ public class ProfileControlsTFController : CRUDControllerBase<IProfileControlsTF
}
}
[NonAction]
[HttpPost]
public override async Task<IActionResult> Create([FromBody] ProfileControlsTFCreateDto createDto)
{
@ -93,6 +94,7 @@ public class ProfileControlsTFController : CRUDControllerBase<IProfileControlsTF
}
}
[NonAction]
[HttpDelete]
public override async Task<IActionResult> Delete([FromRoute] int id)
{

View File

@ -49,7 +49,7 @@ namespace WorkFlow.API.Controllers
return await _service.ReadAsync(
withProfile: withProfile, withUser: withUser, withState,
userId: id,
profileId: profileId, objId: objId, profileActive: profileActive)
profileId: profileId, objId: objId)
.ThenAsync(
Success: pctf => pctf.Any() ? Ok(pctf) : NotFound(),
Fail: IActionResult (msg, ntc) =>

View File

@ -17,4 +17,22 @@ public class StateController : CRUDControllerBaseWithErrorHandling<IStateService
public StateController(ILogger<StateController> logger, IStateService service) : base(logger, service)
{
}
[NonAction]
public override Task<IActionResult> Create(StateCreateDto createDto)
{
return base.Create(createDto);
}
[NonAction]
public override Task<IActionResult> Update(StateUpdateDto updateDto)
{
return base.Update(updateDto);
}
[NonAction]
public override Task<IActionResult> Delete([FromRoute] int id)
{
return base.Delete(id);
}
}

View File

@ -24,4 +24,7 @@ public class Profile
[Column("BACK_COLOR")]
public string? BackColor { get; set; }
[NotMapped]
public IEnumerable<ProfileObject>? Objects;
}

View File

@ -0,0 +1,18 @@
namespace WorkFlow.Domain.Entities;
public class ProfileObject
{
public int? ObjStateId { get; set; }
public int? ObjectId { get; set; }
public string? Headline1 { get; set; }
public string? Headline2 { get; set; }
public string? Subline1 { get; set; }
public string? Subline2 { get; set; }
public string? CmdCheckIn { get; set; }
}