Страница профиля
This commit is contained in:
@@ -6,7 +6,17 @@ namespace Nashel.Modules.Identity.Application.Queries.GetProfile;
|
||||
|
||||
public record GetProfileQuery : IRequest<ProfileResponse>;
|
||||
|
||||
public record ProfileResponse(Guid Id, string Phone, List<string> Roles);
|
||||
public record ProfileResponse(
|
||||
Guid Id,
|
||||
string Phone,
|
||||
List<string> Roles,
|
||||
string FirstName,
|
||||
string LastName,
|
||||
string? Patronymic,
|
||||
string? CompanyName,
|
||||
string FullName,
|
||||
string? AvatarUrl,
|
||||
List<string> Competencies);
|
||||
|
||||
public class GetProfileQueryHandler : IRequestHandler<GetProfileQuery, ProfileResponse>
|
||||
{
|
||||
@@ -33,9 +43,22 @@ public class GetProfileQueryHandler : IRequestHandler<GetProfileQuery, ProfileRe
|
||||
throw new Exception("Account not found");
|
||||
}
|
||||
|
||||
var fullName = $"{account.Profile.FirstName} {account.Profile.LastName}";
|
||||
if (!string.IsNullOrEmpty(account.Profile.Patronymic))
|
||||
{
|
||||
fullName += $" {account.Profile.Patronymic}";
|
||||
}
|
||||
|
||||
return new ProfileResponse(
|
||||
account.Id,
|
||||
account.Phone,
|
||||
account.Roles.Select(r => r.ToString()).ToList());
|
||||
account.Id,
|
||||
account.Phone,
|
||||
account.Roles.Select(r => r.ToString()).ToList(),
|
||||
account.Profile.FirstName,
|
||||
account.Profile.LastName,
|
||||
account.Profile.Patronymic,
|
||||
account.Profile.CompanyName,
|
||||
fullName,
|
||||
account.Profile.AvatarUrl,
|
||||
account.Profile.Competencies.Select(c => c.Name).ToList());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user