Fixed AutoSavedStore's deletion of data when table was using composite keys.

This commit is contained in:
Tom
2025-01-09 03:38:23 +00:00
parent 3429c8f8dc
commit 467c3cf0b0
15 changed files with 202 additions and 221 deletions

View File

@@ -1,10 +1,10 @@
using HermesSocketLibrary.db;
using HermesSocketServer.Models;
using HermesSocketServer.Messages;
using HermesSocketServer.Store.Internal;
namespace HermesSocketServer.Store
{
public class PolicyStore : AutoSavedStore<string, PolicyMessage>
public class PolicyStore : AutoSavedStore<string, Policy>
{
private readonly string _userId;
private readonly Database _database;
@@ -26,7 +26,7 @@ namespace HermesSocketServer.Store
await _database.Execute(sql, data, (reader) =>
{
var id = reader.GetGuid(0);
_store.Add(id.ToString(), new PolicyMessage()
_store.Add(id.ToString(), new Policy()
{
Id = id,
UserId = _userId,
@@ -39,15 +39,15 @@ namespace HermesSocketServer.Store
_logger.Information($"Loaded {_store.Count} policies from database.");
}
protected override void OnInitialAdd(string key, PolicyMessage value)
protected override void OnInitialAdd(string key, Policy value)
{
}
protected override void OnInitialModify(string key, PolicyMessage value)
protected override void OnInitialModify(string key, Policy value)
{
}
protected override void OnInitialRemove(string key)
protected override void OnPostRemove(string key, Policy value)
{
}
}