mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 09:33:13 +00:00
Adds GET /api/notifications, a per-user read model derived from live work-order state: Unassigned (grouped, High), No Vendor and Aveta Missing (per work order, Medium) and Vendor Conflict, account-scoped from claims and ordered by section severity with a fixed reason tie-break.
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using SeaHaven.Services.Exceptions;
|
|
using SeaHaven.Services.Interfaces;
|
|
|
|
namespace Api.SeaHavenIndustries.Controllers
|
|
{
|
|
[Authorize]
|
|
[ApiController]
|
|
[Route("api/notifications")]
|
|
public class NotificationsController : ControllerBase
|
|
{
|
|
private readonly INotificationFeedService _feedService;
|
|
|
|
public NotificationsController(INotificationFeedService feedService)
|
|
{
|
|
_feedService = feedService;
|
|
}
|
|
|
|
[HttpGet]
|
|
public async Task<IActionResult> GetFeed(CancellationToken cancellationToken)
|
|
{
|
|
try
|
|
{
|
|
return Ok(await _feedService.GetFeedAsync(User, cancellationToken));
|
|
}
|
|
catch (WorkOrderBoardValidationException ex) when (ex.Code == "Forbidden")
|
|
{
|
|
return StatusCode(StatusCodes.Status403Forbidden, new
|
|
{
|
|
code = ex.Code,
|
|
message = ex.Message
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|