Added stores for connections. Added requests for groups, group chatters, group permissions & connections. Using TTS Voice State store.
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Collections.Concurrent;
|
||||
using HermesSocketLibrary.db;
|
||||
using HermesSocketServer.Models;
|
||||
using HermesSocketServer.Store;
|
||||
using HermesSocketServer.Validators;
|
||||
|
||||
namespace HermesSocketServer.Services
|
||||
{
|
||||
@@ -38,29 +39,35 @@ namespace HermesSocketServer.Services
|
||||
|
||||
var actionTable = _configuration.Database.Tables["Action"];
|
||||
var chatterTable = _configuration.Database.Tables["Chatter"];
|
||||
var connectionTable = _configuration.Database.Tables["Connection"];
|
||||
//var chatterGroupTable = _configuration.Database.Tables["ChatterGroup"];
|
||||
var groupTable = _configuration.Database.Tables["Group"];
|
||||
var groupPermissionTable = _configuration.Database.Tables["GroupPermission"];
|
||||
var policyTable = _configuration.Database.Tables["Policy"];
|
||||
var redemptionTable = _configuration.Database.Tables["Redemption"];
|
||||
var ttsFilterTable = _configuration.Database.Tables["TtsFilter"];
|
||||
var ttsVoiceStateTable = _configuration.Database.Tables["VoiceState"];
|
||||
|
||||
var chatters = new ChatterStore(userId, chatterTable, _database, _logger);
|
||||
var connections = new ConnectionStore(userId, connectionTable, _database, _logger);
|
||||
var groups = new GroupStore(userId, groupTable, _database, _configuration, _logger);
|
||||
var groupPermissions = new GroupPermissionStore(userId, groupPermissionTable, _database, _logger);
|
||||
var policies = new PolicyStore(userId, policyTable, _database, _logger);
|
||||
var filters = new TTSFilterStore(userId, ttsFilterTable, _database, _logger);
|
||||
var actions = new ActionStore(userId, actionTable, _database, _logger);
|
||||
var redemptions = new RedemptionStore(userId, redemptionTable, _database, _logger);
|
||||
var voiceStates = new VoiceStateStore(userId, new VoiceIdValidator(), ttsVoiceStateTable, _database, _logger);
|
||||
|
||||
Task.WaitAll([
|
||||
chatters.Load(),
|
||||
connections.Load(),
|
||||
groups.Load(),
|
||||
groupPermissions.Load(),
|
||||
policies.Load(),
|
||||
filters.Load(),
|
||||
actions.Load(),
|
||||
redemptions.Load(),
|
||||
voiceStates.Save(),
|
||||
]);
|
||||
|
||||
var channel = new Channel()
|
||||
@@ -68,12 +75,14 @@ namespace HermesSocketServer.Services
|
||||
Id = userId,
|
||||
User = user,
|
||||
Chatters = chatters,
|
||||
Connections = connections,
|
||||
Groups = groups,
|
||||
GroupPermissions = groupPermissions,
|
||||
Policies = policies,
|
||||
Filters = filters,
|
||||
Actions = actions,
|
||||
Redemptions = redemptions,
|
||||
VoiceStates = voiceStates,
|
||||
};
|
||||
|
||||
_channels.Add(userId, channel);
|
||||
@@ -93,12 +102,17 @@ namespace HermesSocketServer.Services
|
||||
if (!_channels.TryGetValue(userId, out var channel))
|
||||
return;
|
||||
|
||||
_logger.Debug($"Saving channel data to database [channel id: {channel.Id}][channel name: {channel.User.Name}]");
|
||||
await Task.WhenAll([
|
||||
channel.Chatters.Save(),
|
||||
channel.Connections.Save(),
|
||||
channel.Groups.Save(),
|
||||
channel.GroupPermissions.Save(),
|
||||
channel.Policies.Save(),
|
||||
channel.Filters.Save(),
|
||||
channel.Actions.Save(),
|
||||
channel.Redemptions.Save(),
|
||||
channel.VoiceStates.Save(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -109,10 +123,14 @@ namespace HermesSocketServer.Services
|
||||
_logger.Debug($"Saving channel data to database [channel id: {channel.Id}][channel name: {channel.User.Name}]");
|
||||
await Task.WhenAll([
|
||||
channel.Chatters.Save(),
|
||||
channel.Connections.Save(),
|
||||
channel.Groups.Save(),
|
||||
channel.GroupPermissions.Save(),
|
||||
channel.Policies.Save(),
|
||||
channel.Filters.Save(),
|
||||
channel.Actions.Save(),
|
||||
channel.Redemptions.Save(),
|
||||
channel.VoiceStates.Save(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user