2020-03-26 12:25:22 +01:00
|
|
|
|
using AutoMapper;
|
|
|
|
|
using ModernKeePass.Domain.Entities;
|
|
|
|
|
using ModernKeePassLib;
|
|
|
|
|
|
|
|
|
|
namespace ModernKeePass.Infrastructure.KeePass
|
|
|
|
|
{
|
|
|
|
|
public class GroupMappingProfile : Profile
|
|
|
|
|
{
|
|
|
|
|
public GroupMappingProfile()
|
|
|
|
|
{
|
|
|
|
|
FromModelToDto();
|
|
|
|
|
FromDtoToModel();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void FromDtoToModel()
|
|
|
|
|
{
|
|
|
|
|
CreateMap<PwGroup, GroupEntity>()
|
2020-04-01 12:48:36 +02:00
|
|
|
|
.ForMember(dest => dest.ParentGroup, opt => opt.Ignore())
|
2020-03-31 19:19:02 +02:00
|
|
|
|
.ForMember(d => d.ParentId, opts => opts.MapFrom(s => s.ParentGroup.Uuid.ToHexString()))
|
2020-03-26 12:25:22 +01:00
|
|
|
|
.ForMember(d => d.Id, opts => opts.MapFrom(s => s.Uuid.ToHexString()))
|
|
|
|
|
.ForMember(d => d.Name, opts => opts.MapFrom(s => s.Name))
|
|
|
|
|
.ForMember(d => d.Icon, opts => opts.MapFrom(s => IconMapper.MapPwIconToIcon(s.IconId)))
|
2020-04-01 12:48:36 +02:00
|
|
|
|
.ForMember(d => d.LastModificationDate, opts => opts.MapFrom(s => s.LastModificationTime))
|
|
|
|
|
.ForMember(d => d.Entries, opts => opts.Ignore())
|
|
|
|
|
.ForMember(d => d.SubGroups, opts => opts.Ignore());
|
2020-03-26 12:25:22 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void FromModelToDto()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|