Files
Wino-Mail/Wino.Server/MessageHandlers/KillAccountSynchronizerHandler.cs

30 lines
1.0 KiB
C#
Raw Permalink Normal View History

2025-02-15 12:53:32 +01:00
using System;
using System.Threading;
using System.Threading.Tasks;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.Server;
using Wino.Messaging.Server;
using Wino.Server.Core;
2025-02-16 11:54:23 +01:00
namespace Wino.Server.MessageHandlers;
public class KillAccountSynchronizerHandler : ServerMessageHandler<KillAccountSynchronizerRequested, bool>
2025-02-15 12:53:32 +01:00
{
2025-02-16 11:54:23 +01:00
private readonly ISynchronizerFactory _synchronizerFactory;
2025-02-15 12:53:32 +01:00
2025-02-16 11:54:23 +01:00
public override WinoServerResponse<bool> FailureDefaultResponse(Exception ex)
=> WinoServerResponse<bool>.CreateErrorResponse(ex.Message);
2025-02-15 12:53:32 +01:00
2025-02-16 11:54:23 +01:00
public KillAccountSynchronizerHandler(ISynchronizerFactory synchronizerFactory)
{
_synchronizerFactory = synchronizerFactory;
}
2025-02-15 12:53:32 +01:00
2025-02-16 11:54:23 +01:00
protected override async Task<WinoServerResponse<bool>> HandleAsync(KillAccountSynchronizerRequested message, CancellationToken cancellationToken = default)
{
await _synchronizerFactory.DeleteSynchronizerAsync(message.AccountId);
2025-02-15 12:53:32 +01:00
2025-02-16 11:54:23 +01:00
return WinoServerResponse<bool>.CreateSuccessResponse(true);
2025-02-15 12:53:32 +01:00
}
}