🐛 Fix Sphere Rewind
This commit is contained in:
@@ -175,7 +175,7 @@ public class BroadcastEventHandler(
|
||||
AccountId = evt.AccountId,
|
||||
Status = status,
|
||||
UpdatedAt = SystemClock.Instance.GetCurrentInstant()
|
||||
}, GrpcTypeHelper.SerializerOptionsWithIgnore)).ToByteArray()
|
||||
}, GrpcTypeHelper.SerializerOptionsWithoutIgnore)).ToByteArray()
|
||||
);
|
||||
|
||||
logger.LogInformation("Broadcasted status update for user {AccountId}", evt.AccountId);
|
||||
@@ -214,7 +214,7 @@ public class BroadcastEventHandler(
|
||||
AccountId = evt.AccountId,
|
||||
Status = status,
|
||||
UpdatedAt = SystemClock.Instance.GetCurrentInstant()
|
||||
}, GrpcTypeHelper.SerializerOptionsWithIgnore)).ToByteArray()
|
||||
}, GrpcTypeHelper.SerializerOptionsWithoutIgnore)).ToByteArray()
|
||||
);
|
||||
|
||||
logger.LogInformation("Broadcasted status update for user {AccountId}", evt.AccountId);
|
||||
|
||||
@@ -727,13 +727,13 @@ public class SubscriptionService(
|
||||
}
|
||||
|
||||
// Update gift status and link
|
||||
gift.Status = DysonNetwork.Shared.Models.GiftStatus.Redeemed;
|
||||
gift.Status = Shared.Models.GiftStatus.Redeemed;
|
||||
gift.RedeemedAt = now;
|
||||
gift.RedeemerId = redeemer.Id;
|
||||
gift.SubscriptionId = sameTypeSubscription.Id;
|
||||
gift.UpdatedAt = now;
|
||||
|
||||
using var transaction = await db.Database.BeginTransactionAsync();
|
||||
await using var transaction = await db.Database.BeginTransactionAsync();
|
||||
try
|
||||
{
|
||||
db.WalletSubscriptions.Update(sameTypeSubscription);
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace DysonNetwork.Shared.Proto;
|
||||
|
||||
public abstract class GrpcTypeHelper
|
||||
{
|
||||
public static readonly JsonSerializerOptions? SerializerOptionsWithIgnore = new JsonSerializerOptions()
|
||||
public static readonly JsonSerializerOptions? SerializerOptionsWithoutIgnore = new JsonSerializerOptions()
|
||||
{
|
||||
NumberHandling = JsonNumberHandling.AllowNamedFloatingPointLiterals,
|
||||
PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower,
|
||||
@@ -161,10 +161,10 @@ public abstract class GrpcTypeHelper
|
||||
};
|
||||
}
|
||||
|
||||
public static ByteString ConvertObjectToByteString(object? obj)
|
||||
public static ByteString ConvertObjectToByteString(object? obj, bool withoutIgnore = true)
|
||||
{
|
||||
return ByteString.CopyFromUtf8(
|
||||
JsonSerializer.Serialize(obj, SerializerOptions)
|
||||
JsonSerializer.Serialize(obj, withoutIgnore ? SerializerOptionsWithoutIgnore : SerializerOptions)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -268,7 +268,7 @@ public class SphereRewindServiceGrpc(
|
||||
{
|
||||
ServiceId = "sphere",
|
||||
AccountId = request.AccountId,
|
||||
Data = GrpcTypeHelper.ConvertObjectToByteString(data),
|
||||
Data = GrpcTypeHelper.ConvertObjectToByteString(data, withoutIgnore: true),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -31,11 +31,11 @@ public abstract class EmbeddableBase
|
||||
{
|
||||
var jsonRaw = JsonSerializer.Serialize(
|
||||
input,
|
||||
GrpcTypeHelper.SerializerOptionsWithIgnore
|
||||
GrpcTypeHelper.SerializerOptionsWithoutIgnore
|
||||
);
|
||||
return JsonSerializer.Deserialize<Dictionary<string, object>>(
|
||||
jsonRaw,
|
||||
GrpcTypeHelper.SerializerOptionsWithIgnore
|
||||
GrpcTypeHelper.SerializerOptionsWithoutIgnore
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user