22 lines
583 B
C#
22 lines
583 B
C#
using Socialize.Modules.Identity.Contracts;
|
|
using Socialize.Modules.Identity.Data;
|
|
|
|
namespace Socialize.Modules.Identity.Services;
|
|
|
|
public sealed class UserLookup(
|
|
UserManager userManager)
|
|
: IUserLookup
|
|
{
|
|
public async Task<UserReference?> GetUserAsync(Guid userId, CancellationToken cancellationToken = default)
|
|
{
|
|
User? user = await userManager.FindByIdAsync(userId.ToString());
|
|
|
|
return user is null
|
|
? null
|
|
: new UserReference(
|
|
user.Id,
|
|
user.Fullname,
|
|
user.PortraitUrl);
|
|
}
|
|
}
|