Added stores for connections. Added requests for groups, group chatters, group permissions & connections. Using TTS Voice State store.
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
using HermesSocketLibrary.db;
|
||||
using HermesSocketLibrary.Socket.Data;
|
||||
using HermesSocketServer.Models;
|
||||
using ILogger = Serilog.ILogger;
|
||||
|
||||
@@ -9,35 +7,18 @@ namespace HermesSocketServer.Requests
|
||||
{
|
||||
public string Name => "get_connections";
|
||||
public string[] RequiredKeys => [];
|
||||
private Database _database;
|
||||
private ILogger _logger;
|
||||
|
||||
public GetConnections(Database database, ILogger logger)
|
||||
public GetConnections(ILogger logger)
|
||||
{
|
||||
_database = database;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task<RequestResult> Grant(Channel channel, IDictionary<string, object> data)
|
||||
public Task<RequestResult> Grant(Channel channel, IDictionary<string, object> data)
|
||||
{
|
||||
var temp = new Dictionary<string, object>() { { "user", channel.Id } };
|
||||
|
||||
var connections = new List<Connection>();
|
||||
string sql = "select \"name\", \"type\", \"clientId\", \"accessToken\", \"grantType\", \"scope\", \"expiresAt\", \"default\" from \"Connection\" where \"userId\" = @user";
|
||||
await _database.Execute(sql, temp, sql =>
|
||||
connections.Add(new Connection()
|
||||
{
|
||||
Name = sql.GetString(0),
|
||||
Type = sql.GetString(1),
|
||||
ClientId = sql.GetString(2),
|
||||
AccessToken = sql.GetString(3),
|
||||
GrantType = sql.GetString(4),
|
||||
Scope = sql.GetString(5),
|
||||
ExpiresAt = sql.GetDateTime(6),
|
||||
Default = sql.GetBoolean(7)
|
||||
})
|
||||
);
|
||||
return RequestResult.Successful(connections, notifyClientsOnAccount: false);
|
||||
var connections = channel.Connections.Get().Values;
|
||||
_logger.Information($"Fetched all connections for channel [channel: {channel.Id}]");
|
||||
return Task.FromResult(RequestResult.Successful(connections, notifyClientsOnAccount: false));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user