Skip to content

Commit

Permalink
Merge pull request #571 from Atralupus/feat/itemslot-with-avataraddress
Browse files Browse the repository at this point in the history
Add avatar address field in ItemSlot
  • Loading branch information
Atralupus authored Dec 26, 2024
2 parents 6e5ed2d + 517fb78 commit da64966
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/auto_assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ addAssignees: author

reviewers:
- Atralupus
- moreal
- boscohyun
- ipdae
- U-lis

numberOfReviewers: 3
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"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":1,"StoredBlockIndex":0}}
{"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}}
4 changes: 3 additions & 1 deletion Mimir.MongoDB.Tests/Bson/ItemSlotDocumentTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ public Task JsonSnapshot()
var docs = new ItemSlotDocument(
default,
default,
new ItemSlotState(TestDataHelpers.LoadState("ItemSlotState.bin")));
default,
new ItemSlotState(TestDataHelpers.LoadState("ItemSlotState.bin"))
);
return Verify(docs.ToJson());
}
}
3 changes: 2 additions & 1 deletion Mimir.MongoDB/Bson/ItemSlotDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ namespace Mimir.MongoDB.Bson;
public record ItemSlotDocument(
[property: BsonIgnore, JsonIgnore] long StoredBlockIndex,
[property: BsonIgnore, JsonIgnore] Address Address,
Address AvatarAddress,
ItemSlotState Object
) : MimirBsonDocument(Address.ToHex(), new DocumentMetadata(1, StoredBlockIndex));
) : MimirBsonDocument(Address.ToHex(), new DocumentMetadata(2, StoredBlockIndex));
2 changes: 1 addition & 1 deletion Mimir.Tests/QueryTests/ItemSlotTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public async Task GraphQL_Query_ItemSlot_Returns_CorrectValue()
Nekoyume.Model.EnumType.BattleType.Adventure
)
)
.ReturnsAsync(new ItemSlotDocument(1, address, state));
.ReturnsAsync(new ItemSlotDocument(1, address, address, state));
var serviceProvider = TestServices.Builder.With(mockRepo.Object).Build();
var query = $$"""
query {
Expand Down
7 changes: 6 additions & 1 deletion Mimir.Worker/CollectionUpdaters/ItemSlotCollectionUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ public static async Task<IEnumerable<WriteModel<BsonDocument>>> UpdateAsync(
}

var itemSlotState = new ItemSlotState(serialized);
var itemSlotDocument = new ItemSlotDocument(blockIndex, itemSlotAddress, itemSlotState);
var itemSlotDocument = new ItemSlotDocument(
blockIndex,
avatarAddress,
itemSlotAddress,
itemSlotState
);
return [itemSlotDocument.ToUpdateOneModel()];
}
}

0 comments on commit da64966

Please sign in to comment.