mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
WIP change to ids
This commit is contained in:
@@ -1,35 +1,31 @@
|
||||
using MediatR;
|
||||
using System.Threading.Tasks;
|
||||
using AutoMapper;
|
||||
using ModernKeePass.Application.Common.Interfaces;
|
||||
using ModernKeePass.Application.Group.Models;
|
||||
using ModernKeePass.Domain.Dtos;
|
||||
using ModernKeePass.Domain.Exceptions;
|
||||
|
||||
namespace ModernKeePass.Application.Database.Commands.CreateDatabase
|
||||
{
|
||||
public class CreateDatabaseCommand : IRequest<GroupVm>
|
||||
public class CreateDatabaseCommand : IRequest
|
||||
{
|
||||
public string FilePath { get; set; }
|
||||
public string Password { get; set; }
|
||||
public string KeyFilePath { get; set; }
|
||||
|
||||
public class CreateDatabaseCommandHandler : IAsyncRequestHandler<CreateDatabaseCommand, GroupVm>
|
||||
public class CreateDatabaseCommandHandler : IAsyncRequestHandler<CreateDatabaseCommand>
|
||||
{
|
||||
private readonly IDatabaseProxy _database;
|
||||
private readonly IMapper _mapper;
|
||||
|
||||
public CreateDatabaseCommandHandler(IDatabaseProxy database, IMapper mapper)
|
||||
public CreateDatabaseCommandHandler(IDatabaseProxy database)
|
||||
{
|
||||
_database = database;
|
||||
_mapper = mapper;
|
||||
}
|
||||
|
||||
public async Task<GroupVm> Handle(CreateDatabaseCommand message)
|
||||
public async Task Handle(CreateDatabaseCommand message)
|
||||
{
|
||||
if (_database.IsOpen) throw new DatabaseOpenException();
|
||||
|
||||
var rootGroup = await _database.Create(
|
||||
await _database.Create(
|
||||
new FileInfo
|
||||
{
|
||||
Path = message.FilePath
|
||||
@@ -39,7 +35,6 @@ namespace ModernKeePass.Application.Database.Commands.CreateDatabase
|
||||
KeyFilePath = message.KeyFilePath,
|
||||
Password = message.Password
|
||||
});
|
||||
return GroupVm.BuildHierarchy(null, rootGroup, _mapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user