Skip to content

Commit

Permalink
Fix deleter.
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle committed Jan 16, 2024
1 parent 0f6ec12 commit 39c9276
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Squidex.Domain.Apps.Entities.MongoDb.Assets;

public sealed class MongoShardedAssetRepository : ShardedSnapshotStore<MongoAssetRepository, Asset>, IAssetRepository
public sealed class MongoShardedAssetRepository : ShardedSnapshotStore<MongoAssetRepository, Asset>, IAssetRepository, IDeleter
{
public MongoShardedAssetRepository(IShardingStrategy sharding, Func<string, MongoAssetRepository> factory)
: base(sharding, factory)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace Squidex.Domain.Apps.Entities.MongoDb.Contents;

public sealed class MongoShardedContentRepository : ShardedSnapshotStore<MongoContentRepository, WriteContent>, IContentRepository
public sealed class MongoShardedContentRepository : ShardedSnapshotStore<MongoContentRepository, WriteContent>, IContentRepository, IDeleter
{
public MongoShardedContentRepository(IShardingStrategy sharding, Func<string, MongoContentRepository> factory)
: base(sharding, factory)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Squidex.Domain.Apps.Entities.MongoDb.Text;

public sealed class MongoShardedTextIndex<T> : ShardedService<MongoTextIndexBase<T>>, ITextIndex where T : class
public sealed class MongoShardedTextIndex<T> : ShardedService<MongoTextIndexBase<T>>, ITextIndex, IDeleter where T : class
{
public MongoShardedTextIndex(IShardingStrategy sharding, Func<string, MongoTextIndexBase<T>> factory)
: base(sharding, factory)
Expand Down Expand Up @@ -52,4 +52,15 @@ public async Task ExecuteAsync(IndexCommand[] commands,
{
return Shard(app.Id).SearchAsync(app, query, scope, ct);
}

public async Task DeleteAppAsync(App app,
CancellationToken ct)
{
var shard = Shard(app.Id) as IDeleter;

if (shard != null)
{
await shard.DeleteAppAsync(app, ct);
}
}
}

0 comments on commit 39c9276

Please sign in to comment.