mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
1st working version in clean arch
WIP Parent group mapping issues
This commit is contained in:
@@ -1,18 +1,8 @@
|
||||
using AutoMapper;
|
||||
using ModernKeePass.Application.Common.Mappings;
|
||||
using ModernKeePass.Domain.Entities;
|
||||
|
||||
namespace ModernKeePass.Application.Cryptography.Models
|
||||
namespace ModernKeePass.Application.Parameters.Models
|
||||
{
|
||||
public class CipherVm: IMapFrom<BaseEntity>
|
||||
public class CipherVm
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public void Mapping(Profile profile)
|
||||
{
|
||||
profile.CreateMap<BaseEntity, CipherVm>()
|
||||
.ForMember(d => d.Id, opts => opts.MapFrom(s => s.Id))
|
||||
.ForMember(d => d.Name, opts => opts.MapFrom(s => s.Name));
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,19 +1,9 @@
|
||||
using AutoMapper;
|
||||
using ModernKeePass.Application.Common.Mappings;
|
||||
using ModernKeePass.Domain.Entities;
|
||||
|
||||
namespace ModernKeePass.Application.Cryptography.Models
|
||||
namespace ModernKeePass.Application.Parameters.Models
|
||||
{
|
||||
public class KeyDerivationVm : IMapFrom<BaseEntity>
|
||||
public class KeyDerivationVm
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public void Mapping(Profile profile)
|
||||
{
|
||||
profile.CreateMap<BaseEntity, CipherVm>()
|
||||
.ForMember(d => d.Id, opts => opts.MapFrom(s => s.Id))
|
||||
.ForMember(d => d.Name, opts => opts.MapFrom(s => s.Name));
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,27 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
using AutoMapper;
|
||||
using System.Linq;
|
||||
using MediatR;
|
||||
using ModernKeePass.Application.Common.Interfaces;
|
||||
using ModernKeePass.Application.Cryptography.Models;
|
||||
using ModernKeePass.Application.Parameters.Models;
|
||||
|
||||
namespace ModernKeePass.Application.Cryptography.Queries.GetCiphers
|
||||
namespace ModernKeePass.Application.Parameters.Queries.GetCiphers
|
||||
{
|
||||
public class GetCiphersQuery: IRequest<IEnumerable<CipherVm>>
|
||||
{
|
||||
public class GetCiphersQueryHandler: IRequestHandler<GetCiphersQuery, IEnumerable<CipherVm>>
|
||||
{
|
||||
private readonly ICryptographyClient _cryptography;
|
||||
private readonly IMapper _mapper;
|
||||
|
||||
public GetCiphersQueryHandler(ICryptographyClient cryptography, IMapper mapper)
|
||||
public GetCiphersQueryHandler(ICryptographyClient cryptography)
|
||||
{
|
||||
_cryptography = cryptography;
|
||||
_mapper = mapper;
|
||||
}
|
||||
|
||||
public IEnumerable<CipherVm> Handle(GetCiphersQuery message)
|
||||
{
|
||||
yield return _mapper.Map<CipherVm>(_cryptography.Ciphers);
|
||||
return _cryptography.Ciphers.Select(c => new CipherVm
|
||||
{
|
||||
Id = c.Id,
|
||||
Name = c.Name
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ using System.Linq;
|
||||
using MediatR;
|
||||
using ModernKeePass.Application.Common.Interfaces;
|
||||
|
||||
namespace ModernKeePass.Application.Cryptography.Queries.GetCompressions
|
||||
namespace ModernKeePass.Application.Parameters.Queries.GetCompressions
|
||||
{
|
||||
public class GetCompressionsQuery : IRequest<IEnumerable<string>>
|
||||
{
|
||||
|
@@ -1,27 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
using AutoMapper;
|
||||
using System.Linq;
|
||||
using MediatR;
|
||||
using ModernKeePass.Application.Common.Interfaces;
|
||||
using ModernKeePass.Application.Cryptography.Models;
|
||||
using ModernKeePass.Application.Parameters.Models;
|
||||
|
||||
namespace ModernKeePass.Application.Cryptography.Queries.GetKeyDerivations
|
||||
namespace ModernKeePass.Application.Parameters.Queries.GetKeyDerivations
|
||||
{
|
||||
public class GetKeyDerivationsQuery : IRequest<IEnumerable<KeyDerivationVm>>
|
||||
{
|
||||
public class GetKeyDerivationsQueryHandler : IRequestHandler<GetKeyDerivationsQuery, IEnumerable<KeyDerivationVm>>
|
||||
{
|
||||
private readonly ICryptographyClient _cryptography;
|
||||
private readonly IMapper _mapper;
|
||||
|
||||
public GetKeyDerivationsQueryHandler(ICryptographyClient cryptography, IMapper mapper)
|
||||
public GetKeyDerivationsQueryHandler(ICryptographyClient cryptography)
|
||||
{
|
||||
_cryptography = cryptography;
|
||||
_mapper = mapper;
|
||||
}
|
||||
|
||||
public IEnumerable<KeyDerivationVm> Handle(GetKeyDerivationsQuery message)
|
||||
{
|
||||
yield return _mapper.Map<KeyDerivationVm>(_cryptography.KeyDerivations);
|
||||
return _cryptography.KeyDerivations.Select(c => new KeyDerivationVm
|
||||
{
|
||||
Id = c.Id,
|
||||
Name = c.Name
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user