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
+8 -6
View File
@@ -2,21 +2,23 @@
namespace Bitvault;
public class ArchiveItemHandler(IValueStore<Item> valueStore,
ICache<Item> cache,
public class ArchiveItemHandler(IValueStore<Item<(Guid, string)>> valueStore,
ICache<Item<(Guid, string)>> cache,
IMediator mediator) :
INotificationHandler<ArchiveEventArgs<Item>>
INotificationHandler<ArchiveEventArgs<Item<(Guid, string)>>>
{
public async Task Handle(ArchiveEventArgs<Item> args)
public async Task Handle(ArchiveEventArgs<Item<(Guid, string)>> args)
{
try
{
if (valueStore.Value is Item item)
if (valueStore.Value is Item<(Guid, string)> item)
{
if (cache.Contains(item))
{
(Guid id, string name) = item.Value;
await mediator.Handle<UpdateEventArgs<(Guid, int)>,
bool>(new UpdateEventArgs<(Guid, int)>((item.Id, 2)));
bool>(new UpdateEventArgs<(Guid, int)>((id, 2)));
cache.Remove(item);
}