Moved Requests classes to here. Added some checks to requests.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using HermesSocketLibrary.db;
|
||||
using HermesSocketLibrary.Requests;
|
||||
using HermesSocketLibrary.Socket.Data;
|
||||
|
||||
namespace HermesSocketServer.Requests
|
||||
@@ -7,7 +6,7 @@ namespace HermesSocketServer.Requests
|
||||
public class GetConnections : IRequest
|
||||
{
|
||||
public string Name => "get_connections";
|
||||
|
||||
public string[] RequiredKeys => [];
|
||||
private Database _database;
|
||||
private Serilog.ILogger _logger;
|
||||
|
||||
@@ -22,8 +21,8 @@ namespace HermesSocketServer.Requests
|
||||
var temp = new Dictionary<string, object>() { { "user", sender } };
|
||||
|
||||
var connections = new List<Connection>();
|
||||
string sql3 = "select \"name\", \"type\", \"clientId\", \"accessToken\", \"grantType\", \"scope\", \"expiresAt\", \"default\" from \"Connection\" where \"userId\" = @user";
|
||||
await _database.Execute(sql3, temp, sql =>
|
||||
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),
|
||||
@@ -36,7 +35,7 @@ namespace HermesSocketServer.Requests
|
||||
Default = sql.GetBoolean(7)
|
||||
})
|
||||
);
|
||||
return new RequestResult(true, connections, false);
|
||||
return RequestResult.Successful(connections, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user