Subindo alterações para produção
This commit is contained in:
parent
bafa97cf3b
commit
e6cd510a29
|
|
@ -10,7 +10,7 @@ namespace line_gestao_api.Controllers
|
|||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
[Authorize]
|
||||
[Authorize(Roles = "admin")]
|
||||
public class BillingController : ControllerBase
|
||||
{
|
||||
private readonly AppDbContext _db;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace line_gestao_api.Controllers
|
|||
{
|
||||
[ApiController]
|
||||
[Route("api/chips-virgens")]
|
||||
[Authorize]
|
||||
[Authorize(Roles = "admin")]
|
||||
public class ChipsVirgensController : ControllerBase
|
||||
{
|
||||
private readonly AppDbContext _db;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace line_gestao_api.Controllers
|
|||
{
|
||||
[ApiController]
|
||||
[Route("api/controle-recebidos")]
|
||||
[Authorize]
|
||||
[Authorize(Roles = "admin")]
|
||||
public class ControleRecebidosController : ControllerBase
|
||||
{
|
||||
private readonly AppDbContext _db;
|
||||
|
|
|
|||
|
|
@ -97,6 +97,28 @@ public class NotificationsController : ControllerBase
|
|||
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("/notifications/read-all")]
|
||||
public async Task<IActionResult> MarkAllAsRead(
|
||||
|
|
@ -114,6 +136,22 @@ public class NotificationsController : ControllerBase
|
|||
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("/notifications/export")]
|
||||
public async Task<IActionResult> ExportNotifications([FromQuery] string? filter)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace line_gestao_api.Controllers;
|
|||
|
||||
[ApiController]
|
||||
[Route("api/parcelamentos")]
|
||||
[Authorize]
|
||||
[Authorize(Roles = "admin")]
|
||||
public class ParcelamentosController : ControllerBase
|
||||
{
|
||||
private readonly AppDbContext _db;
|
||||
|
|
|
|||
Loading…
Reference in New Issue