You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

NotificationController.cs 1.0KB

12345678910111213141516171819202122232425262728293031
  1. using Diligent.WebAPI.Host.DTOs.Notification;
  2. using Diligent.WebAPI.Host.Mediator.Notifications.Commands;
  3. using Diligent.WebAPI.Host.Mediator.Notifications.Queries;
  4. using MediatR;
  5. using Microsoft.AspNetCore.Mvc;
  6. using System.Diagnostics.CodeAnalysis;
  7. namespace Diligent.WebAPI.Host.Controllers
  8. {
  9. [ApiVersion("1.0")]
  10. [ApiController]
  11. [Route("v{version:apiVersion}/[controller]")]
  12. [ExcludeFromCodeCoverage]
  13. public class NotificationController : ControllerBase
  14. {
  15. private readonly IMediator _mediator;
  16. public NotificationController(IMediator mediator)
  17. {
  18. _mediator = mediator;
  19. }
  20. [HttpGet("{id}")]
  21. public async Task<IActionResult> GetNotifications([FromRoute] string id) =>
  22. Ok(await _mediator.Send(new GetNotificationsQuery(id)));
  23. [HttpPost]
  24. public async Task<IActionResult> ReadNotifications([FromBody] NotificationDeleteDTO userConnection) =>
  25. Ok(await _mediator.Send(new DeleteNotificationCommand(userConnection)));
  26. }
  27. }