Skip to content

Commit 2debe17

Browse files
committed
Added email & username
1 parent 873c6ab commit 2debe17

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

TableBooking.Api/Controllers/UserController.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
namespace TableBooking.Controllers
88
{
9+
using Model.Models;
10+
911
[Route("[controller]")]
1012
[ApiController]
1113
[Authorize]
@@ -43,13 +45,12 @@ public async Task<IActionResult> Logout()
4345
throw new NotImplementedException();
4446
}
4547

46-
// TODO: endpoint user info.
4748
[HttpGet]
4849
[Authorize]
4950
[Route("{id:guid}")]
50-
public async Task<IActionResult> GetUserInfo(Guid id)
51+
public async Task<AppUserDto> GetUserInfo(Guid id)
5152
{
52-
return await _userService.GetUserInfo(id);
53+
return await _userService.GetUserInfo(id, CancellationToken.None);
5354
}
5455
}
5556
}

TableBooking.Api/Interfaces/IUserService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ namespace TableBooking.Api.Interfaces
1010
public interface IUserService
1111
{
1212
public Task<IActionResult> Register(UserRegisterDto userRegisterDTO);
13-
public Task<IActionResult> Login(UserLoginDto userLoginDTO, CancellationToken cancellationToken);
14-
public Task<AppUser> GetUserInfo(Guid id);
13+
public Task<IActionResult> Login(UserLoginDto userLoginDTO);
14+
public Task<AppUserDto> GetUserInfo(Guid id, CancellationToken cancellationToken);
1515
public Task SeedRoles();
1616
}
1717
}

TableBooking.Model/Dtos/UserDtos/AppUserDto.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ namespace TableBooking.Model.Dtos.UserDtos;
55
public class AppUserDto
66
{
77
public IEnumerable<Booking> Bookings { get; set; }
8+
public string? Email { get; set; } = string.Empty;
9+
public string? Username { get; set; } = string.Empty;
810
}

TableBooking.Model/Models/AppUser.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ public AppUserDto ToDto()
1616
{
1717
return new AppUserDto
1818
{
19-
Bookings = Bookings
19+
Bookings = Bookings,
20+
Email = this.Email,
21+
Username = this.UserName
2022
};
2123
}
2224
}

0 commit comments

Comments
 (0)