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