Adding entries and groups works again

Entry history almost fully functional
Some refactoring
This commit is contained in:
Geoffroy BONNEVILLE
2020-04-03 17:33:53 +02:00
parent 36aa8914fa
commit b875f3c89d
12 changed files with 75 additions and 40 deletions

View File

@@ -8,7 +8,6 @@ namespace ModernKeePass.Application.Common.Interfaces
string Id { get; set; }
string Title { get; set; }
Icon Icon { get; set; }
List<IEntityVm> Breadcrumb { get; }
string ParentGroupId { get; set; }
string ParentGroupName { get; set; }
}

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using AutoMapper;
using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Application.Common.Mappings;
@@ -13,7 +14,6 @@ namespace ModernKeePass.Application.Entry.Models
{
public string ParentGroupId { get; set; }
public string ParentGroupName { get; set; }
public List<IEntityVm> Breadcrumb { get; } = new List<IEntityVm>();
public string Id { get; set; }
public string Title { get; set; }
public string Username { get; set; }
@@ -46,7 +46,7 @@ namespace ModernKeePass.Application.Entry.Models
.ForMember(d => d.Url, opts => opts.MapFrom(s => s.Url))
.ForMember(d => d.Notes, opts => opts.MapFrom(s => s.Notes))
.ForMember(d => d.AdditionalFields, opts => opts.MapFrom(s => s.AdditionalFields))
.ForMember(d => d.History, opts => opts.MapFrom(s => s.History))
.ForMember(d => d.History, opts => opts.MapFrom(s => s.History.OrderByDescending(h => h.LastModificationDate)))
.ForMember(d => d.HasExpirationDate, opts => opts.MapFrom(s => s.HasExpirationDate))
.ForMember(d => d.ExpirationDate, opts => opts.MapFrom(s => s.ExpirationDate))
.ForMember(d => d.ModificationDate, opts => opts.MapFrom(s => s.LastModificationDate))

View File

@@ -16,7 +16,6 @@ namespace ModernKeePass.Application.Group.Models
public string Id { get; set; }
public string Title { get; set; }
public Icon Icon { get; set; }
public List<IEntityVm> Breadcrumb { get; } = new List<IEntityVm>();
public List<GroupVm> SubGroups { get; set; }
public List<EntryVm> Entries { get; set; }
public bool IsSelected { get; set; }

View File

@@ -1,13 +1,12 @@
using MediatR;
using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Application.Group.Models;
using ModernKeePass.Domain.Exceptions;
namespace ModernKeePass.Application.Parameters.Commands.SetRecycleBin
{
public class SetRecycleBinCommand : IRequest
{
public GroupVm RecycleBin { get; set; }
public string RecycleBinId { get; set; }
public class SetRecycleBinCommandHandler : IRequestHandler<SetRecycleBinCommand>
{
@@ -20,7 +19,7 @@ namespace ModernKeePass.Application.Parameters.Commands.SetRecycleBin
public void Handle(SetRecycleBinCommand message)
{
if (_database.IsOpen) _database.SetRecycleBin(message.RecycleBin.Id);
if (_database.IsOpen) _database.SetRecycleBin(message.RecycleBinId);
else throw new DatabaseClosedException();
}
}