ソースを参照

Merge branch 'feature/1371_user_management' of Neca/HRCenter into BE_dev

pull/22/head
safet.purkovic 3年前
コミット
25d8bba40c

+ 6
- 1
Diligent.WebAPI.Business/MappingProfiles/UserMappingProfile.cs ファイルの表示

@@ -1,4 +1,5 @@
using System;
using Diligent.WebAPI.Contracts.DTOs.User;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -13,6 +14,10 @@ namespace Diligent.WebAPI.Business.MappingProfiles
#region DTO to Model
CreateMap<CreateUserRequestDto, User>();
#endregion

#region Model to DTO
CreateMap<User, UserResponseDTO>();
#endregion
}
}
}

+ 18
- 0
Diligent.WebAPI.Contracts/DTOs/User/UserResponseDTO.cs ファイルの表示

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Diligent.WebAPI.Contracts.DTOs.User
{
public class UserResponseDTO
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
//public string CVLink { get; set; }
//public string Position { get; set; }
}
}

+ 9
- 4
Diligent.WebAPI.Host/Controllers/V1/UsersController.cs ファイルの表示

@@ -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")]

読み込み中…
キャンセル
保存