Skip to content

Commit

Permalink
Register ItemSlotRepository
Browse files Browse the repository at this point in the history
  • Loading branch information
Atralupus committed Dec 22, 2024
1 parent e35d564 commit d49e983
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Mimir.MongoDB/Repositories/ItemSlotRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public interface IItemSlotRepository
Task<ItemSlotDocument> GetByAddressAsync(Address avatarAddress, BattleType battleType);
}

public class ItemSlotRepository(IMongoDbService dbService)
public class ItemSlotRepository(IMongoDbService dbService) : IItemSlotRepository
{
public async Task<ItemSlotDocument> GetByAddressAsync(
Address avatarAddress,
Expand Down
22 changes: 15 additions & 7 deletions Mimir/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
using Microsoft.Extensions.Options;
using Mimir.GraphQL;
using Mimir.MongoDB.Repositories;
using Mimir.Options;
using Mimir.MongoDB.Services;
using Mimir.Options;
using BalanceRepository = Mimir.MongoDB.Repositories.BalanceRepository;

var builder = WebApplication.CreateBuilder(args);
Expand All @@ -35,22 +35,27 @@
builder.Services.AddAuthorization();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSingleton<IMongoDbService, MongoDbService>();

// NOTE: MongoDB repositories. Sort in alphabetical order.
builder.Services.AddSingleton<IActionPointRepository, ActionPointRepository>();
builder.Services.AddSingleton<IAgentRepository, AgentRepository>();
builder.Services.AddSingleton<IAllCombinationSlotStateRepository, AllCombinationSlotStateRepository>();
builder.Services.AddSingleton<
IAllCombinationSlotStateRepository,
AllCombinationSlotStateRepository
>();
builder.Services.AddSingleton<AllRuneRepository>();
builder.Services.AddSingleton<ArenaRepository>();
builder.Services.AddSingleton<ArenaParticipantRepository>();
builder.Services.AddSingleton<IAvatarRepository, AvatarRepository>();
builder.Services.AddSingleton<IBalanceRepository, BalanceRepository>();
builder.Services.AddSingleton<ICollectionRepository,CollectionRepository>();
builder.Services.AddSingleton<ICollectionRepository, CollectionRepository>();
builder.Services.AddSingleton<IDailyRewardRepository, DailyRewardRepository>();
builder.Services.AddSingleton<IInventoryRepository, InventoryRepository>();
builder.Services.AddSingleton<ItemSlotRepository>();
builder.Services.AddSingleton<IPetRepository, PetRepository>();
builder.Services.AddSingleton<IMetadataRepository,MetadataRepository>();
builder.Services.AddSingleton<IMetadataRepository, MetadataRepository>();
builder.Services.AddSingleton<IProductRepository, ProductRepository>();
builder.Services.AddSingleton<IItemSlotRepository, ItemSlotRepository>();
builder.Services.AddSingleton<IPledgeRepository, PledgeRepository>();
builder.Services.AddSingleton<IProductsRepository, ProductsRepository>();
builder.Services.AddSingleton<IStakeRepository, StakeRepository>();
Expand All @@ -63,16 +68,19 @@
// ~MongoDB repositories.
builder.Services.AddCors();
builder.Services.AddHttpClient();
builder.Services
.AddGraphQLServer()
builder
.Services.AddGraphQLServer()
.AddLib9cGraphQLTypes()
.AddMimirGraphQLTypes()
.AddErrorFilter<ErrorFilter>()
.AddMongoDbPagingProviders(providerName: "MongoDB", defaultProvider: true)
.BindRuntimeType(typeof(Address), typeof(AddressType))
.BindRuntimeType(typeof(BigInteger), typeof(BigIntegerType))
.BindRuntimeType(typeof(HashDigest<SHA256>), typeof(HashDigestSHA256Type))
.ModifyRequestOptions(requestExecutorOptions => { requestExecutorOptions.IncludeExceptionDetails = true; });
.ModifyRequestOptions(requestExecutorOptions =>
{
requestExecutorOptions.IncludeExceptionDetails = true;
});
builder.Services.AddHttpContextAccessor();
builder.Services.AddHttpResponseFormatter<HttpResponseFormatter>();

Expand Down

0 comments on commit d49e983

Please sign in to comment.