WorkFlow/src/WorkFlow.API/Controllers/ProfileController.cs
TekH 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

73 lines
1.8 KiB
C#

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using WorkFlow.API.Attributes;
using WorkFlow.Application.Contracts;
using WorkFlow.Domain.Entities;
namespace WorkFlow.API.Controllers;
[APIKeyAuth]
[Route("api/[controller]")]
[ApiController]
[Authorize]
public class ProfileController : ControllerBase
{
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);
}
}
}