Sebastian Stehle
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
10 additions and
10 deletions
-
backend/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetRepository.cs
|
|
|
@ -129,27 +129,27 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Assets |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public async Task<IAssetEntity?> FindAssetBySlugAsync(DomainId appId, string slug) |
|
|
|
public async Task<IReadOnlyList<IAssetEntity>> QueryByHashAsync(DomainId appId, string hash) |
|
|
|
{ |
|
|
|
using (Profiler.TraceMethod<MongoAssetRepository>()) |
|
|
|
{ |
|
|
|
var assetEntity = |
|
|
|
await Collection.Find(x => x.IndexedAppId == appId && !x.IsDeleted && x.Slug == slug) |
|
|
|
.FirstOrDefaultAsync(); |
|
|
|
var assetEntities = |
|
|
|
await Collection.Find(x => x.IndexedAppId == appId && !x.IsDeleted && x.FileHash == hash) |
|
|
|
.ToListAsync(); |
|
|
|
|
|
|
|
return assetEntity; |
|
|
|
return assetEntities.OfType<IAssetEntity>().ToList(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public async Task<IReadOnlyList<IAssetEntity>> QueryByHashAsync(DomainId appId, string hash) |
|
|
|
public async Task<IAssetEntity?> FindAssetBySlugAsync(DomainId appId, string slug) |
|
|
|
{ |
|
|
|
using (Profiler.TraceMethod<MongoAssetRepository>()) |
|
|
|
{ |
|
|
|
var assetEntities = |
|
|
|
await Collection.Find(x => x.IndexedAppId == appId && !x.IsDeleted && x.FileHash == hash) |
|
|
|
.ToListAsync(); |
|
|
|
var assetEntity = |
|
|
|
await Collection.Find(x => x.IndexedAppId == appId && !x.IsDeleted && x.Slug == slug) |
|
|
|
.FirstOrDefaultAsync(); |
|
|
|
|
|
|
|
return assetEntities.OfType<IAssetEntity>().ToList(); |
|
|
|
return assetEntity; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|