From 57ce5164a335f454c0a0aac7340af23369c9166b Mon Sep 17 00:00:00 2001 From: Timo Notheisen Date: Mon, 12 Feb 2024 13:18:14 +0100 Subject: [PATCH] chore: remove unused file --- .../IdentitiesQueryableExtensions.cs | 17 ----------------- .../Repository/IdentitiesRepository.cs | 6 +++--- 2 files changed, 3 insertions(+), 20 deletions(-) delete mode 100644 Modules/Quotas/src/Quotas.Infrastructure/Persistence/Database/QueryableExtensions/IdentitiesQueryableExtensions.cs diff --git a/Modules/Quotas/src/Quotas.Infrastructure/Persistence/Database/QueryableExtensions/IdentitiesQueryableExtensions.cs b/Modules/Quotas/src/Quotas.Infrastructure/Persistence/Database/QueryableExtensions/IdentitiesQueryableExtensions.cs deleted file mode 100644 index ba8912c419..0000000000 --- a/Modules/Quotas/src/Quotas.Infrastructure/Persistence/Database/QueryableExtensions/IdentitiesQueryableExtensions.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Backbone.Modules.Quotas.Domain.Aggregates.Identities; -using Microsoft.EntityFrameworkCore; - -namespace Backbone.Modules.Quotas.Infrastructure.Persistence.Database.QueryableExtensions; -public static class IdentitiesQueryableExtensions -{ - public static async Task> WithTier(this IQueryable query, string tierId, CancellationToken cancellationToken) - { - var identities = await query.Where(identity => identity.TierId == tierId).ToListAsync(cancellationToken); - return identities; - } - - public static async Task FirstWithAddress(this IQueryable query, string address, CancellationToken cancellationToken) - { - return await query.Where(identity => identity.Address == address).FirstOrDefaultAsync(cancellationToken); - } -} diff --git a/Modules/Quotas/src/Quotas.Infrastructure/Persistence/Repository/IdentitiesRepository.cs b/Modules/Quotas/src/Quotas.Infrastructure/Persistence/Repository/IdentitiesRepository.cs index 39d33dd648..205ed30fcf 100644 --- a/Modules/Quotas/src/Quotas.Infrastructure/Persistence/Repository/IdentitiesRepository.cs +++ b/Modules/Quotas/src/Quotas.Infrastructure/Persistence/Repository/IdentitiesRepository.cs @@ -3,7 +3,6 @@ using Backbone.Modules.Quotas.Domain.Aggregates.Identities; using Backbone.Modules.Quotas.Domain.Aggregates.Tiers; using Backbone.Modules.Quotas.Infrastructure.Persistence.Database; -using Backbone.Modules.Quotas.Infrastructure.Persistence.Database.QueryableExtensions; using Microsoft.EntityFrameworkCore; namespace Backbone.Modules.Quotas.Infrastructure.Persistence.Repository; @@ -31,7 +30,7 @@ public async Task Add(Identity identity, CancellationToken cancellationToken) { var identity = await (track ? _identitiesDbSet : _readOnlyIdentities) .IncludeAll(_dbContext) - .FirstWithAddress(address, cancellationToken); + .FirstOrDefaultAsync(i => i.Address == address, cancellationToken); return identity; } @@ -48,7 +47,8 @@ public async Task> FindWithTier(TierId tierId, Cancellatio { var identities = await (track ? _identitiesDbSet : _readOnlyIdentities) .IncludeAll(_dbContext) - .WithTier(tierId, cancellationToken); + .Where(i => i.TierId == tierId) + .ToListAsync(cancellationToken); return identities; }