mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
test to make server
This commit is contained in:
@@ -20,6 +20,9 @@ public class MappingProfile : Profile
|
||||
|
||||
CreateMap<User, UserDto>()
|
||||
.AfterMap<UserToUserDtoMappingAction>();
|
||||
|
||||
CreateMap<UserProfile, UserProfileDto>()
|
||||
.AfterMap<UserProfileToUserProfileDtoMappingAction>();
|
||||
|
||||
CreateMap<Friendship, FriendshipDto>();
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using AutoMapper;
|
||||
using Govor.Application.Interfaces.UserOnlineStatus;
|
||||
using Govor.Application.Profiles;
|
||||
using Govor.Contracts.DTOs;
|
||||
using Govor.Core.Models.Users;
|
||||
|
||||
namespace Govor.API.Common.Mapping;
|
||||
|
||||
public class UserProfileToUserProfileDtoMappingAction : IMappingAction<UserProfile, UserProfileDto>
|
||||
{
|
||||
private readonly IOnlineUserStore _onlineUserStore;
|
||||
|
||||
public UserProfileToUserProfileDtoMappingAction(IOnlineUserStore onlineUserStore)
|
||||
{
|
||||
_onlineUserStore = onlineUserStore;
|
||||
}
|
||||
|
||||
public void Process(UserProfile source, UserProfileDto destination, ResolutionContext context)
|
||||
{
|
||||
destination.IsOnline = _onlineUserStore.IsOnline(source.Id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user