Changed the default way to modify values in store. Added basic validation to stores. Using interfaces to DI store objects.
This commit is contained in:
@@ -7,14 +7,14 @@ namespace HermesSocketServer.Services
|
||||
{
|
||||
public class ChannelManager
|
||||
{
|
||||
private readonly UserStore _users;
|
||||
private readonly IStore<string, User> _users;
|
||||
private readonly Database _database;
|
||||
private readonly ServerConfiguration _configuration;
|
||||
private readonly Serilog.ILogger _logger;
|
||||
private readonly IDictionary<string, Channel> _channels;
|
||||
private readonly object _lock;
|
||||
|
||||
public ChannelManager(UserStore users, Database database, ServerConfiguration configuration, Serilog.ILogger logger)
|
||||
public ChannelManager(IStore<string, User> users, Database database, ServerConfiguration configuration, Serilog.ILogger logger)
|
||||
{
|
||||
_users = users;
|
||||
_database = database;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using HermesSocketLibrary.db;
|
||||
using HermesSocketLibrary.Requests.Messages;
|
||||
using HermesSocketServer.Models;
|
||||
using HermesSocketServer.Store;
|
||||
|
||||
namespace HermesSocketServer.Services
|
||||
@@ -6,12 +8,12 @@ namespace HermesSocketServer.Services
|
||||
public class DatabaseService : BackgroundService
|
||||
{
|
||||
private readonly ChannelManager _channels;
|
||||
private readonly VoiceStore _voices;
|
||||
private readonly UserStore _users;
|
||||
private readonly IStore<string, TTSVoice> _voices;
|
||||
private readonly IStore<string, User> _users;
|
||||
private readonly ServerConfiguration _configuration;
|
||||
private readonly Serilog.ILogger _logger;
|
||||
|
||||
public DatabaseService(ChannelManager channels, VoiceStore voices, UserStore users, ServerConfiguration configuration, Serilog.ILogger logger)
|
||||
public DatabaseService(ChannelManager channels, IStore<string, TTSVoice> voices, IStore<string, User> users, ServerConfiguration configuration, Serilog.ILogger logger)
|
||||
{
|
||||
_channels = channels;
|
||||
_voices = voices;
|
||||
|
||||
Reference in New Issue
Block a user