Added database table data into configuration. Store saves is auto-handled. Added Action & Redemption stores.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using HermesSocketLibrary.Requests.Messages;
|
||||
using HermesSocketServer.Models;
|
||||
using HermesSocketServer.Store;
|
||||
using ILogger = Serilog.ILogger;
|
||||
@@ -8,7 +9,7 @@ namespace HermesSocketServer.Requests
|
||||
{
|
||||
public string Name => "delete_tts_voice";
|
||||
public string[] RequiredKeys => ["voice"];
|
||||
private IStore<string, Voice> _voices;
|
||||
private IStore<string, TTSVoice> _voices;
|
||||
private ILogger _logger;
|
||||
|
||||
public DeleteTTSVoice(VoiceStore voices, ILogger logger)
|
||||
@@ -20,9 +21,16 @@ namespace HermesSocketServer.Requests
|
||||
public Task<RequestResult> Grant(Channel channel, IDictionary<string, object> data)
|
||||
{
|
||||
string voiceId = data["voice"].ToString()!;
|
||||
_voices.Remove(voiceId);
|
||||
_logger.Information($"Deleted a voice by id [voice id: {voiceId}]");
|
||||
return Task.FromResult(RequestResult.Successful(null));
|
||||
var result = _voices.Remove(voiceId);
|
||||
|
||||
if (result)
|
||||
{
|
||||
_logger.Information($"Deleted a voice by id [voice id: {voiceId}]");
|
||||
return Task.FromResult(RequestResult.Successful(null));
|
||||
}
|
||||
|
||||
_logger.Warning($"Voice ID does not exist [id: {voiceId}]");
|
||||
return Task.FromResult(RequestResult.Failed("Voice ID does not exist."));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user