Add ProfileController with MediatR GET endpoint
Introduced ProfileController to the API, implementing a GET endpoint that uses MediatR to handle ReadProfileViewQuery requests and return profile data. This supports CQRS and structured profile retrieval.
This commit is contained in:
16
src/ReC.API/Controllers/ProfileController.cs
Normal file
16
src/ReC.API/Controllers/ProfileController.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ReC.Application.Profile.Queries;
|
||||
|
||||
namespace ReC.API.Controllers;
|
||||
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class ProfileController(IMediator mediator) : ControllerBase
|
||||
{
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetProfile([FromQuery] ReadProfileViewQuery query, CancellationToken cancel)
|
||||
{
|
||||
return Ok(await mediator.Send(query, cancel));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user