Added policy messages for WS. Fixed DB changes via stores. Updated chat voices messages via WS to use stores.

This commit is contained in:
Tom
2024-10-21 20:44:20 +00:00
parent e3c78d96fa
commit 94e0d54c31
19 changed files with 255 additions and 137 deletions

28
Requests/GetPolicies.cs Normal file
View File

@@ -0,0 +1,28 @@
using HermesSocketServer.Services;
using ILogger = Serilog.ILogger;
namespace HermesSocketServer.Requests
{
public class GetPolicies : IRequest
{
public string Name => "get_policies";
public string[] RequiredKeys => [];
private ChannelManager _channels;
private ILogger _logger;
public GetPolicies(ChannelManager channels, ILogger logger)
{
_channels = channels;
_logger = logger;
}
public async Task<RequestResult> Grant(string sender, IDictionary<string, object>? data)
{
var channel = _channels.Get(sender);
var results = channel.Policies.Get().Values;
_logger.Information($"Fetched policies for channel [policy size: {results.Count}][channel: {sender}]");
return RequestResult.Successful(results, notifyClientsOnAccount: false);
}
}
}