Skip to content

Commit

Permalink
feature reenvio de e-mail
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoBentoPrisma committed Feb 19, 2024
1 parent 20c0c89 commit f721c16
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
17 changes: 15 additions & 2 deletions OpenAdm.Api/Controllers/PedidoController.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using OpenAdm.Api.Attributes;
using OpenAdm.Application.Dtos.Pedidos;
using OpenAdm.Application.Interfaces;
using OpenAdm.Domain.Exceptions;
using OpenAdm.Domain.PaginateDto;

namespace OpenAdm.Api.Controllers;
Expand Down Expand Up @@ -94,4 +92,19 @@ public async Task<IActionResult> GetPedidos([FromQuery] int statusPedido)
return await HandleErrorAsync(ex);
}
}

[IsFuncionario]
[HttpGet("reenviar-pedido")]
public async Task<IActionResult> ReenviarPedido([FromQuery] Guid pedidoId)
{
try
{
await _pedidoService.ReenviarPedidoViaEmailAsync(pedidoId);
return Ok();
}
catch (Exception ex)
{
return await HandleErrorAsync(ex);
}
}
}
1 change: 1 addition & 0 deletions OpenAdm.Application/Interfaces/IPedidoService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ public interface IPedidoService
Task<bool> DeletePedidoAsync(Guid id);
Task<List<PedidoViewModel>> GetPedidosUsuarioAsync(int statusPedido);
Task<PedidoViewModel> CreatePedidoAsync(PedidoCreateDto pedidoCreateDto);
Task ReenviarPedidoViaEmailAsync(Guid pedidoId);
}
5 changes: 5 additions & 0 deletions OpenAdm.Application/Services/PedidoService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ public async Task<List<PedidoViewModel>> GetPedidosUsuarioAsync(int statusPedido
.ToList();
}

public async Task ReenviarPedidoViaEmailAsync(Guid pedidoId)
{
await _processarPedidoService.ProcessarCreateAsync(pedidoId);
}

public async Task<PedidoViewModel> UpdateStatusPedidoAsync(UpdateStatusPedidoDto updateStatusPedidoDto)
{
var pedido = await _pedidoRepository.GetPedidoByIdAsync(updateStatusPedidoDto.PedidoId)
Expand Down

0 comments on commit f721c16

Please sign in to comment.