Skip to content

Commit

Permalink
comment Solve
Browse files Browse the repository at this point in the history
  • Loading branch information
sguoo committed Dec 3, 2024
1 parent 526ca8d commit d49ca81
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Lib9c.Models/States/CollectionState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class CollectionState : IBencodable
[BsonIgnore, GraphQLIgnore, JsonIgnore]
public IValue Bencoded => List.Empty.Add(new List(Ids));

public CollectionState() { }

public CollectionState(IValue bencoded)
{
if (bencoded is not List l)
Expand Down
7 changes: 6 additions & 1 deletion Mimir.MongoDB/Repositories/CollectionRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@

namespace Mimir.MongoDB.Repositories;

public class CollectionRepository(IMongoDbService dbService)
public interface ICollectionRepository
{
Task<CollectionDocument> GetByAddressAsync(Address address);
}

public class CollectionRepository(IMongoDbService dbService) : ICollectionRepository
{
public async Task<CollectionDocument> GetByAddressAsync(Address address)
{
Expand Down
2 changes: 1 addition & 1 deletion Mimir/GraphQL/Queries/Query.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public async Task<string> GetBalanceAsync(
/// </summary>
/// <param name="address">The address of the avatar.</param>
/// <returns>The collection state for the specified avatar address.</returns>
public async Task<CollectionState> GetCollectionAsync(Address address, [Service] CollectionRepository repo) =>
public async Task<CollectionState> GetCollectionAsync(Address address, [Service] ICollectionRepository repo) =>
(await repo.GetByAddressAsync(address)).Object;

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Mimir/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
builder.Services.AddSingleton<ArenaParticipantRepository>();
builder.Services.AddSingleton<IAvatarRepository, AvatarRepository>();
builder.Services.AddSingleton<BalanceRepository>();
builder.Services.AddSingleton<CollectionRepository>();
builder.Services.AddSingleton<ICollectionRepository,CollectionRepository>();
builder.Services.AddSingleton<IDailyRewardRepository, DailyRewardRepository>();
builder.Services.AddSingleton<InventoryRepository>();
builder.Services.AddSingleton<ItemSlotRepository>();
Expand Down

0 comments on commit d49ca81

Please sign in to comment.