feat: return user's role name inside UserInfoDTO

This commit is contained in:
2025-07-21 09:47:31 +02:00
parent d53b85fe9e
commit 1f9c04e2fc
4 changed files with 16 additions and 8 deletions

View File

@@ -5,18 +5,18 @@ namespace QuotifyBE.Mapping;
public static class UserMapping
{
public static SuccessfulLoginDTO ToSuccessfulLoginDTO(this User user, string token)
public static SuccessfulLoginDTO ToSuccessfulLoginDTO(this User user, string token, string? roleName)
{
return new SuccessfulLoginDTO
{
Status = "ok",
Token = token,
User = user.ToUserInfoDTO()
User = user.ToUserInfoDTO(roleName)
};
}
public static UserInfoDTO ToUserInfoDTO(this User user)
public static UserInfoDTO ToUserInfoDTO(this User user, string? roleName)
{
return new UserInfoDTO
@@ -24,7 +24,8 @@ public static class UserMapping
Id = user.Id,
Name = user.Name,
Email = user.Email,
Role = user.Role
Role = user.Role,
RoleName = roleName
};
}
}