Subindo alterações para produção

This commit is contained in:
Eduardo 2026-02-12 16:47:15 -03:00
parent bafa97cf3b
commit e6cd510a29
5 changed files with 42 additions and 4 deletions

View File

@ -10,7 +10,7 @@ namespace line_gestao_api.Controllers
{ {
[ApiController] [ApiController]
[Route("api/[controller]")] [Route("api/[controller]")]
[Authorize] [Authorize(Roles = "admin")]
public class BillingController : ControllerBase public class BillingController : ControllerBase
{ {
private readonly AppDbContext _db; private readonly AppDbContext _db;

View File

@ -11,7 +11,7 @@ namespace line_gestao_api.Controllers
{ {
[ApiController] [ApiController]
[Route("api/chips-virgens")] [Route("api/chips-virgens")]
[Authorize] [Authorize(Roles = "admin")]
public class ChipsVirgensController : ControllerBase public class ChipsVirgensController : ControllerBase
{ {
private readonly AppDbContext _db; private readonly AppDbContext _db;

View File

@ -11,7 +11,7 @@ namespace line_gestao_api.Controllers
{ {
[ApiController] [ApiController]
[Route("api/controle-recebidos")] [Route("api/controle-recebidos")]
[Authorize] [Authorize(Roles = "admin")]
public class ControleRecebidosController : ControllerBase public class ControleRecebidosController : ControllerBase
{ {
private readonly AppDbContext _db; private readonly AppDbContext _db;

View File

@ -97,6 +97,28 @@ public class NotificationsController : ControllerBase
return NoContent(); return NoContent();
} }
[HttpPatch("{id:guid}/unread")]
[HttpPatch("/notifications/{id:guid}/unread")]
public async Task<IActionResult> MarkAsUnread(Guid id)
{
var notification = await _db.Notifications
.FirstOrDefaultAsync(n => n.Id == id);
if (notification is null)
{
return NotFound();
}
if (notification.Lida)
{
notification.Lida = false;
notification.LidaEm = null;
await _db.SaveChangesAsync();
}
return NoContent();
}
[HttpPatch("read-all")] [HttpPatch("read-all")]
[HttpPatch("/notifications/read-all")] [HttpPatch("/notifications/read-all")]
public async Task<IActionResult> MarkAllAsRead( public async Task<IActionResult> MarkAllAsRead(
@ -114,6 +136,22 @@ public class NotificationsController : ControllerBase
return NoContent(); return NoContent();
} }
[HttpPatch("unread-all")]
[HttpPatch("/notifications/unread-all")]
public async Task<IActionResult> MarkAllAsUnread(
[FromQuery] string? filter,
[FromBody] NotificationSelectionRequest? request)
{
var query = ApplySelectionAndFilter(_db.Notifications, filter, request?.NotificationIds)
.Where(n => n.Lida);
await query.ExecuteUpdateAsync(updates => updates
.SetProperty(n => n.Lida, false)
.SetProperty(n => n.LidaEm, (DateTime?)null));
return NoContent();
}
[HttpGet("export")] [HttpGet("export")]
[HttpGet("/notifications/export")] [HttpGet("/notifications/export")]
public async Task<IActionResult> ExportNotifications([FromQuery] string? filter) public async Task<IActionResult> ExportNotifications([FromQuery] string? filter)

View File

@ -9,7 +9,7 @@ namespace line_gestao_api.Controllers;
[ApiController] [ApiController]
[Route("api/parcelamentos")] [Route("api/parcelamentos")]
[Authorize] [Authorize(Roles = "admin")]
public class ParcelamentosController : ControllerBase public class ParcelamentosController : ControllerBase
{ {
private readonly AppDbContext _db; private readonly AppDbContext _db;