-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInternalController.cs
More file actions
36 lines (32 loc) · 1.13 KB
/
Copy pathInternalController.cs
File metadata and controls
36 lines (32 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Glense.AccountService.DTOs;
using Glense.AccountService.Services;
namespace Glense.AccountService.Controllers
{
[ApiController]
[Route("api/internal")]
[Authorize]
public class InternalController : ControllerBase
{
private readonly INotificationService _notificationService;
private readonly ILogger<InternalController> _logger;
public InternalController(INotificationService notificationService, ILogger<InternalController> logger)
{
_notificationService = notificationService;
_logger = logger;
}
[HttpPost("notifications")]
public async Task<ActionResult<NotificationDto>> CreateNotification(
[FromBody] CreateNotificationRequest request)
{
var notification = await _notificationService.CreateNotificationAsync(
request.UserId,
request.Title,
request.Message,
request.Type,
request.RelatedEntityId);
return Ok(notification);
}
}
}