mirror of
https://github.com/QuotifyTeam/QuotifyBE.git
synced 2025-12-16 19:00:07 +01:00
feat: return user's role name inside UserInfoDTO
This commit is contained in:
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user