From 98962795588236650df422ed2aaaa43047a4edd1 Mon Sep 17 00:00:00 2001 From: Atralupus Date: Sat, 28 Dec 2024 04:33:55 +0900 Subject: [PATCH] fix unique ids --- .../Bson/ItemSlotDocumentTest.JsonSnapshot.verified.txt | 2 +- .../Bson/RuneSlotDocumentTest.JsonSnapshot.verified.txt | 2 +- Mimir.MongoDB/Bson/ItemSlotDocument.cs | 6 +++--- Mimir.MongoDB/Bson/RuneSlotDocument.cs | 6 +++--- .../CollectionUpdaters/ItemSlotCollectionUpdater.cs | 2 +- .../CollectionUpdaters/RuneSlotCollectionUpdater.cs | 2 +- Mimir/Program.cs | 1 - 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Mimir.MongoDB.Tests/Bson/ItemSlotDocumentTest.JsonSnapshot.verified.txt b/Mimir.MongoDB.Tests/Bson/ItemSlotDocumentTest.JsonSnapshot.verified.txt index cf8515d0..f2936ff6 100644 --- a/Mimir.MongoDB.Tests/Bson/ItemSlotDocumentTest.JsonSnapshot.verified.txt +++ b/Mimir.MongoDB.Tests/Bson/ItemSlotDocumentTest.JsonSnapshot.verified.txt @@ -1 +1 @@ -{"ItemSlotAddress":"0000000000000000000000000000000000000000","Object":{"BattleType":"Adventure","Costumes":[],"Equipments":["0468bfd9-7c76-4379-b1bc-10a3da90c584","0c4c772f-70d9-4a0d-b7e6-4cf25ad7f8f9","13164d27-1948-44a9-9bc7-b23a00aacc5f","2d9d4118-0e3b-445e-aa16-8203e50d2523","4da15d1b-503c-4e08-8476-6f405192258c","98c3abdb-17bc-49a0-8f9c-a61f48662dc7","a45c62d6-e612-4a0e-957a-9ecb7ae6f04f"]},"Metadata":{"SchemaVersion":2,"StoredBlockIndex":0}} \ No newline at end of file +{"AvatarAddress":"0000000000000000000000000000000000000000","Object":{"BattleType":"Adventure","Costumes":[],"Equipments":["0468bfd9-7c76-4379-b1bc-10a3da90c584","0c4c772f-70d9-4a0d-b7e6-4cf25ad7f8f9","13164d27-1948-44a9-9bc7-b23a00aacc5f","2d9d4118-0e3b-445e-aa16-8203e50d2523","4da15d1b-503c-4e08-8476-6f405192258c","98c3abdb-17bc-49a0-8f9c-a61f48662dc7","a45c62d6-e612-4a0e-957a-9ecb7ae6f04f"]},"Metadata":{"SchemaVersion":2,"StoredBlockIndex":0}} \ No newline at end of file diff --git a/Mimir.MongoDB.Tests/Bson/RuneSlotDocumentTest.JsonSnapshot.verified.txt b/Mimir.MongoDB.Tests/Bson/RuneSlotDocumentTest.JsonSnapshot.verified.txt index e162a2a5..27823783 100644 --- a/Mimir.MongoDB.Tests/Bson/RuneSlotDocumentTest.JsonSnapshot.verified.txt +++ b/Mimir.MongoDB.Tests/Bson/RuneSlotDocumentTest.JsonSnapshot.verified.txt @@ -1 +1 @@ -{"RuneSlotAddress":"0000000000000000000000000000000000000000","Object":{"BattleType":"Adventure","Slots":[{"Index":0,"RuneSlotType":"Default","RuneType":"Stat","IsLock":false,"RuneId":10012},{"Index":1,"RuneSlotType":"Ncg","RuneType":"Stat","IsLock":true},{"Index":2,"RuneSlotType":"Stake","RuneType":"Stat","IsLock":true},{"Index":3,"RuneSlotType":"Default","RuneType":"Skill","IsLock":false},{"Index":4,"RuneSlotType":"Ncg","RuneType":"Skill","IsLock":true},{"Index":5,"RuneSlotType":"Stake","RuneType":"Skill","IsLock":true},{"Index":6,"RuneSlotType":"Crystal","RuneType":"Stat","IsLock":true},{"Index":7,"RuneSlotType":"Crystal","RuneType":"Skill","IsLock":true}]},"Metadata":{"SchemaVersion":1,"StoredBlockIndex":0}} \ No newline at end of file +{"AvatarAddress":"0000000000000000000000000000000000000000","Object":{"BattleType":"Adventure","Slots":[{"Index":0,"RuneSlotType":"Default","RuneType":"Stat","IsLock":false,"RuneId":10012},{"Index":1,"RuneSlotType":"Ncg","RuneType":"Stat","IsLock":true},{"Index":2,"RuneSlotType":"Stake","RuneType":"Stat","IsLock":true},{"Index":3,"RuneSlotType":"Default","RuneType":"Skill","IsLock":false},{"Index":4,"RuneSlotType":"Ncg","RuneType":"Skill","IsLock":true},{"Index":5,"RuneSlotType":"Stake","RuneType":"Skill","IsLock":true},{"Index":6,"RuneSlotType":"Crystal","RuneType":"Stat","IsLock":true},{"Index":7,"RuneSlotType":"Crystal","RuneType":"Skill","IsLock":true}]},"Metadata":{"SchemaVersion":1,"StoredBlockIndex":0}} \ No newline at end of file diff --git a/Mimir.MongoDB/Bson/ItemSlotDocument.cs b/Mimir.MongoDB/Bson/ItemSlotDocument.cs index 5f28718b..9fc6d68c 100644 --- a/Mimir.MongoDB/Bson/ItemSlotDocument.cs +++ b/Mimir.MongoDB/Bson/ItemSlotDocument.cs @@ -8,7 +8,7 @@ namespace Mimir.MongoDB.Bson; [BsonIgnoreExtraElements] public record ItemSlotDocument( [property: BsonIgnore, JsonIgnore] long StoredBlockIndex, - [property: BsonIgnore, JsonIgnore] Address AvatarAddress, - Address ItemSlotAddress, + [property: BsonIgnore, JsonIgnore] Address Address, + Address AvatarAddress, ItemSlotState Object -) : MimirBsonDocument(AvatarAddress.ToHex(), new DocumentMetadata(2, StoredBlockIndex)); +) : MimirBsonDocument(Address.ToHex(), new DocumentMetadata(2, StoredBlockIndex)); diff --git a/Mimir.MongoDB/Bson/RuneSlotDocument.cs b/Mimir.MongoDB/Bson/RuneSlotDocument.cs index 298f9c16..1cf3e81e 100644 --- a/Mimir.MongoDB/Bson/RuneSlotDocument.cs +++ b/Mimir.MongoDB/Bson/RuneSlotDocument.cs @@ -8,7 +8,7 @@ namespace Mimir.MongoDB.Bson; [BsonIgnoreExtraElements] public record RuneSlotDocument( [property: BsonIgnore, JsonIgnore] long StoredBlockIndex, - [property: BsonIgnore, JsonIgnore] Address AvatarAddress, - Address RuneSlotAddress, + [property: BsonIgnore, JsonIgnore] Address Address, + Address AvatarAddress, RuneSlotState Object -) : MimirBsonDocument(AvatarAddress.ToHex(), new DocumentMetadata(1, StoredBlockIndex)); +) : MimirBsonDocument(Address.ToHex(), new DocumentMetadata(1, StoredBlockIndex)); diff --git a/Mimir.Worker/CollectionUpdaters/ItemSlotCollectionUpdater.cs b/Mimir.Worker/CollectionUpdaters/ItemSlotCollectionUpdater.cs index 64dc678b..b0f0b987 100644 --- a/Mimir.Worker/CollectionUpdaters/ItemSlotCollectionUpdater.cs +++ b/Mimir.Worker/CollectionUpdaters/ItemSlotCollectionUpdater.cs @@ -31,8 +31,8 @@ public static async Task>> UpdateAsync( var itemSlotState = new ItemSlotState(serialized); var itemSlotDocument = new ItemSlotDocument( blockIndex, - avatarAddress, itemSlotAddress, + avatarAddress, itemSlotState ); return [itemSlotDocument.ToUpdateOneModel()]; diff --git a/Mimir.Worker/CollectionUpdaters/RuneSlotCollectionUpdater.cs b/Mimir.Worker/CollectionUpdaters/RuneSlotCollectionUpdater.cs index 2c71cb6d..36dedc77 100644 --- a/Mimir.Worker/CollectionUpdaters/RuneSlotCollectionUpdater.cs +++ b/Mimir.Worker/CollectionUpdaters/RuneSlotCollectionUpdater.cs @@ -32,8 +32,8 @@ public static async Task>> UpdateAsync( var runeSlotState = new RuneSlotState(serialized); var runeSlotDocument = new RuneSlotDocument( blockIndex, - avatarAddress, runeSlotAddress, + avatarAddress, runeSlotState ); return [runeSlotDocument.ToUpdateOneModel()]; diff --git a/Mimir/Program.cs b/Mimir/Program.cs index b1b126aa..b4521a9f 100644 --- a/Mimir/Program.cs +++ b/Mimir/Program.cs @@ -51,7 +51,6 @@ builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); -builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton();