1st working version in clean arch

WIP Parent group mapping issues
This commit is contained in:
Geoffroy BONNEVILLE
2020-03-30 19:43:04 +02:00
parent d1ba73ee9d
commit e4bd788ed3
54 changed files with 319 additions and 283 deletions

View File

@@ -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
});
}
}
}