|
|
|
@@ -1,4 +1,7 @@ |
|
|
|
namespace Diligent.WebAPI.Host.Controllers.V1 |
|
|
|
using Diligent.WebAPI.Contracts.DTOs.User; |
|
|
|
using Diligent.WebAPI.Data.Entities; |
|
|
|
|
|
|
|
namespace Diligent.WebAPI.Host.Controllers.V1 |
|
|
|
{ |
|
|
|
[ApiVersion("1.0")] |
|
|
|
[Route("v{version:apiVersion}/users")] |
|
|
|
@@ -6,19 +9,21 @@ |
|
|
|
public class UsersController : ControllerBase |
|
|
|
{ |
|
|
|
private readonly IUserService _userService; |
|
|
|
private readonly IMapper _mapper; |
|
|
|
private readonly IEmailer _emailer; |
|
|
|
|
|
|
|
public UsersController(IUserService userService, IEmailer emailer) |
|
|
|
public UsersController(IUserService userService, IEmailer emailer, IMapper mapper) |
|
|
|
{ |
|
|
|
_userService = userService; |
|
|
|
_mapper = mapper; |
|
|
|
_emailer = emailer; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Authorize] |
|
|
|
[HttpGet] |
|
|
|
public async Task<IActionResult> GetAll() |
|
|
|
{ |
|
|
|
return Ok("Hello from protected route"); |
|
|
|
return Ok(_mapper.Map<IEnumerable<User?>, IEnumerable<UserResponseDTO>>(await _userService.GetAll())); |
|
|
|
} |
|
|
|
|
|
|
|
[HttpGet("ForgotPassword")] |