diff --git a/src/presentation/DigitalData.MessagingService.API/Controllers/EmailAccountController.cs b/src/presentation/DigitalData.MessagingService.API/Controllers/EmailAccountController.cs new file mode 100644 index 0000000..f8f5189 --- /dev/null +++ b/src/presentation/DigitalData.MessagingService.API/Controllers/EmailAccountController.cs @@ -0,0 +1,27 @@ +using DigitalData.MessagingService.Application.EmailAccounts.Queries; +using MediatR; +using Microsoft.AspNetCore.Mvc; + +namespace DigitalData.MessagingService.API.Controllers; + +/// +/// +/// +[Route("api/[controller]")] +[ApiController] +public class EmailAccountController(IMediator mediator) : ControllerBase +{ + /// + /// + /// + /// + /// + /// + [HttpGet] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public async Task GetEmailAccount([FromQuery] GetEmailAccountQuery query, CancellationToken cancellationToken) + { + return Ok(await mediator.Send(query, cancellationToken)); + } +} diff --git a/src/presentation/DigitalData.MessagingService.API/Middleware/ExceptionHandlingMiddleware.cs b/src/presentation/DigitalData.MessagingService.API/Middleware/ExceptionHandlingMiddleware.cs index 8f41e08..e07305b 100644 --- a/src/presentation/DigitalData.MessagingService.API/Middleware/ExceptionHandlingMiddleware.cs +++ b/src/presentation/DigitalData.MessagingService.API/Middleware/ExceptionHandlingMiddleware.cs @@ -35,6 +35,9 @@ public class ExceptionHandlingMiddleware(RequestDelegate Next, ILogger (HttpStatusCode.NotFound, notFoundEx.Message), + BadRequestException badRequestEx => + (HttpStatusCode.BadRequest, badRequestEx.Message), + AuthenticationFailedException authEx => (HttpStatusCode.Unauthorized, authEx.Message),