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,3 +1,4 @@
using HermesSocketServer.Messages;
using HermesSocketServer.Models;
using ILogger = Serilog.ILogger;
@ -22,7 +23,7 @@ namespace HermesSocketServer.Requests
int count = int.Parse(data["count"].ToString()!);
int span = int.Parse(data["span"].ToString()!);
var policy = new PolicyMessage()
var policy = new Policy()
{
Id = id,
UserId = channel.Id,

View File

@ -1,3 +1,4 @@
using HermesSocketServer.Messages;
using HermesSocketServer.Models;
using ILogger = Serilog.ILogger;
@ -22,7 +23,7 @@ namespace HermesSocketServer.Requests
int count = int.Parse(data["count"].ToString()!);
int span = int.Parse(data["span"].ToString()!);
bool result = channel.Policies.Set(id.ToString(), new PolicyMessage()
bool result = channel.Policies.Set(id.ToString(), new Policy()
{
Id = id,
UserId = channel.Id,

View File

@ -1,4 +1,3 @@
using HermesSocketLibrary.Requests.Messages;
using HermesSocketServer.Models;
using ILogger = Serilog.ILogger;
@ -26,17 +25,7 @@ namespace HermesSocketServer.Requests
return Task.FromResult(RequestResult.Failed("Order must be an integer."));
bool state = data["state"].ToString()?.ToLower() == "true";
var redemption = new Redemption()
{
Id = id,
UserId = channel.Id,
RedemptionId = redemptionId,
ActionName = actionName,
Order = order,
State = true,
};
bool result = channel.Redemptions.Modify(id.ToString(), r =>
bool result = channel.Redemptions.Modify(id, r =>
{
if (r.UserId != channel.Id)
return;
@ -50,7 +39,7 @@ namespace HermesSocketServer.Requests
var r = channel.Redemptions.Get(id);
if (result)
{
_logger.Information($"Added redemption to channel [id: {id}][redemption id: {redemptionId}][action: {actionName}][order: {order}][channel: {channel.Id}]");
_logger.Information($"Updated redemption to channel [id: {id}][redemption id: {redemptionId}][action: {actionName}][order: {order}][channel: {channel.Id}]");
return Task.FromResult(RequestResult.Successful(r));
}