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:
Tom
2025-01-16 19:49:02 +00:00
parent b00c72ec2a
commit ee3f128a9f
24 changed files with 173 additions and 61 deletions

View File

@ -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;