diff --git a/src/server/RobinTTY.PersonalFinanceDashboard.API/Resolvers/Queries/BankAccountQueryResolvers.cs b/src/server/RobinTTY.PersonalFinanceDashboard.API/Resolvers/Queries/BankAccountQueryResolvers.cs
index b64e22d..717cd66 100644
--- a/src/server/RobinTTY.PersonalFinanceDashboard.API/Resolvers/Queries/BankAccountQueryResolvers.cs
+++ b/src/server/RobinTTY.PersonalFinanceDashboard.API/Resolvers/Queries/BankAccountQueryResolvers.cs
@@ -1,4 +1,5 @@
-using HotChocolate.Types;
+using HotChocolate.Data;
+using HotChocolate.Types;
using RobinTTY.PersonalFinanceDashboard.Core.Models;
using RobinTTY.PersonalFinanceDashboard.Infrastructure.Repositories;
@@ -15,19 +16,21 @@ public sealed class BankAccountQueryResolvers
///
/// The repository to use for data retrieval.
/// The id of the account to lookup.
- public async Task GetBankAccount(BankAccountRepository repository, Guid accountId)
+ [UseSingleOrDefault]
+ [UseProjection]
+ public IQueryable GetBankAccount(BankAccountRepository repository, Guid accountId)
{
- return await repository.GetBankAccount(accountId);
+ return repository.GetBankAccount(accountId);
}
- // TODO: there is no input here like the comment indicates
///
- /// Look up accounts by a list of ids.
+ /// Look up accounts.
///
/// The injected repository to use for data retrieval.
[UsePaging]
- public async Task> GetBankAccounts(BankAccountRepository repository)
+ [UseProjection]
+ public IQueryable GetBankAccounts(BankAccountRepository repository)
{
- return await repository.GetBankAccounts();
+ return repository.GetBankAccounts();
}
}
diff --git a/src/server/RobinTTY.PersonalFinanceDashboard.Infrastructure/Repositories/BankAccountRepository.cs b/src/server/RobinTTY.PersonalFinanceDashboard.Infrastructure/Repositories/BankAccountRepository.cs
index 10d2643..089b3f8 100644
--- a/src/server/RobinTTY.PersonalFinanceDashboard.Infrastructure/Repositories/BankAccountRepository.cs
+++ b/src/server/RobinTTY.PersonalFinanceDashboard.Infrastructure/Repositories/BankAccountRepository.cs
@@ -24,18 +24,18 @@ public BankAccountRepository(ApplicationDbContext dbContext)
///
/// The id of the to retrieve.
/// The if one ist matched otherwise .
- public async Task GetBankAccount(Guid accountId)
+ public IQueryable GetBankAccount(Guid accountId)
{
- return await _dbContext.BankAccounts.SingleOrDefaultAsync(account => account.Id == accountId);
+ return _dbContext.BankAccounts.Where(account => account.Id == accountId);
}
///
/// Gets a list of s.
///
/// A list of s.
- public async Task> GetBankAccounts()
+ public IQueryable GetBankAccounts()
{
- return await _dbContext.BankAccounts.ToListAsync();
+ return _dbContext.BankAccounts;
}
///