switched to valuetuples for exhanging tokens

This commit is contained in:
TheXamlGuy
2024-05-27 20:43:18 +01:00
parent 1be1399511
commit 9535f75835
17 changed files with 85 additions and 94 deletions
+6 -5
View File
@@ -4,21 +4,22 @@ using Toolkit.Foundation;
namespace Bitvault;
public class UnarchiveItemHandler(IValueStore<Item> valueStore,
public class UnarchiveItemHandler(IValueStore<Item<(Guid, string)>> valueStore,
IDbContextFactory<LockerContext> dbContextFactory) :
INotificationHandler<UnarchiveEventArgs<Item>>
INotificationHandler<UnarchiveEventArgs<Item<(Guid, string)>>>
{
public async Task Handle(UnarchiveEventArgs<Item> args)
public async Task Handle(UnarchiveEventArgs<Item<(Guid, string)>> args)
{
try
{
if (valueStore.Value is Item item)
if (valueStore.Value is Item<(Guid, string)> item)
{
(Guid id, string name) = item.Value;
await Task.Run(async () =>
{
using LockerContext context = await dbContextFactory.CreateDbContextAsync();
if (await context.FindAsync<ItemEntry>(item.Id) is ItemEntry result)
if (await context.FindAsync<ItemEntry>(id) is ItemEntry result)
{
result.State = 0;
await context.SaveChangesAsync();