Added policy messages for WS. Fixed DB changes via stores. Updated chat voices messages via WS to use stores.

This commit is contained in:
Tom
2024-10-21 20:44:20 +00:00
parent e3c78d96fa
commit 94e0d54c31
19 changed files with 255 additions and 137 deletions

View File

@@ -32,8 +32,8 @@ namespace HermesSocketServer.Store
string sql = $"SELECT \"chatterId\", \"ttsVoiceId\" FROM \"TtsChatVoice\" WHERE \"userId\" = @user";
await _database.Execute(sql, data, (reader) =>
{
string chatterId = reader.GetInt64(0).ToString();
_store.Add(chatterId, new ChatterVoice()
var chatterId = reader.GetInt64(0);
_store.Add(chatterId.ToString(), new ChatterVoice()
{
UserId = _userId,
ChatterId = chatterId,
@@ -70,7 +70,7 @@ namespace HermesSocketServer.Store
}
_logger.Debug($"TtsChatVoice - Adding {count} rows to database: {sql}");
await _database.ExecuteScalar(sql);
await _database.ExecuteScalarTransaction(sql);
}
if (_modified.Any())
{
@@ -81,7 +81,7 @@ namespace HermesSocketServer.Store
_modified.Clear();
}
_logger.Debug($"TtsChatVoice - Modifying {count} rows in database: {sql}");
await _database.ExecuteScalar(sql);
await _database.ExecuteScalarTransaction(sql);
}
if (_deleted.Any())
{
@@ -92,7 +92,7 @@ namespace HermesSocketServer.Store
_deleted.Clear();
}
_logger.Debug($"TtsChatVoice - Deleting {count} rows from database: {sql}");
await _database.ExecuteScalar(sql);
await _database.ExecuteScalarTransaction(sql);
}
return true;
}