|
|
|
@ -17,6 +17,7 @@ using Squidex.Domain.Apps.Entities.Contents; |
|
|
|
using Squidex.Domain.Apps.Entities.Contents.Repositories; |
|
|
|
using Squidex.Domain.Apps.Entities.Schemas; |
|
|
|
using Squidex.Infrastructure; |
|
|
|
using Squidex.Infrastructure.Log; |
|
|
|
|
|
|
|
namespace Squidex.Domain.Apps.Entities.MongoDb.Contents |
|
|
|
{ |
|
|
|
@ -45,50 +46,65 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents |
|
|
|
contentsPublished.Initialize(); |
|
|
|
} |
|
|
|
|
|
|
|
public Task<IResultList<IContentEntity>> QueryAsync(IAppEntity app, ISchemaEntity schema, Status[] status, ODataUriParser odataQuery) |
|
|
|
public async Task<IResultList<IContentEntity>> QueryAsync(IAppEntity app, ISchemaEntity schema, Status[] status, ODataUriParser odataQuery) |
|
|
|
{ |
|
|
|
using (Profiler.TraceMethod<MongoContentRepository>("QueryAsyncByQuery")) |
|
|
|
{ |
|
|
|
if (RequiresPublished(status)) |
|
|
|
{ |
|
|
|
return contentsPublished.QueryAsync(app, schema, odataQuery); |
|
|
|
return await contentsPublished.QueryAsync(app, schema, odataQuery); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
return contentsDraft.QueryAsync(app, schema, odataQuery, status, true); |
|
|
|
return await contentsDraft.QueryAsync(app, schema, odataQuery, status, true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public Task<IResultList<IContentEntity>> QueryAsync(IAppEntity app, ISchemaEntity schema, Status[] status, HashSet<Guid> ids) |
|
|
|
public async Task<IResultList<IContentEntity>> QueryAsync(IAppEntity app, ISchemaEntity schema, Status[] status, HashSet<Guid> ids) |
|
|
|
{ |
|
|
|
using (Profiler.TraceMethod<MongoContentRepository>("QueryAsyncByIds")) |
|
|
|
{ |
|
|
|
if (RequiresPublished(status)) |
|
|
|
{ |
|
|
|
return contentsPublished.QueryAsync(app, schema, ids); |
|
|
|
return await contentsPublished.QueryAsync(app, schema, ids); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
return contentsDraft.QueryAsync(app, schema, ids, status); |
|
|
|
return await contentsDraft.QueryAsync(app, schema, ids, status); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public Task<IContentEntity> FindContentAsync(IAppEntity app, ISchemaEntity schema, Status[] status, Guid id) |
|
|
|
public async Task<IContentEntity> FindContentAsync(IAppEntity app, ISchemaEntity schema, Status[] status, Guid id) |
|
|
|
{ |
|
|
|
using (Profiler.TraceMethod<MongoContentRepository>()) |
|
|
|
{ |
|
|
|
if (RequiresPublished(status)) |
|
|
|
{ |
|
|
|
return contentsPublished.FindContentAsync(app, schema, id); |
|
|
|
return await contentsPublished.FindContentAsync(app, schema, id); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
return contentsDraft.FindContentAsync(app, schema, id); |
|
|
|
return await contentsDraft.FindContentAsync(app, schema, id); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public Task<IReadOnlyList<Guid>> QueryNotFoundAsync(Guid appId, Guid schemaId, IList<Guid> ids) |
|
|
|
public async Task<IReadOnlyList<Guid>> QueryNotFoundAsync(Guid appId, Guid schemaId, IList<Guid> ids) |
|
|
|
{ |
|
|
|
using (Profiler.TraceMethod<MongoContentRepository>()) |
|
|
|
{ |
|
|
|
return contentsDraft.QueryNotFoundAsync(appId, schemaId, ids); |
|
|
|
await contentsDraft.QueryNotFoundAsync(appId, schemaId, ids); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public Task QueryScheduledWithoutDataAsync(Instant now, Func<IContentEntity, Task> callback) |
|
|
|
public async Task QueryScheduledWithoutDataAsync(Instant now, Func<IContentEntity, Task> callback) |
|
|
|
{ |
|
|
|
return contentsDraft.QueryScheduledWithoutDataAsync(now, callback); |
|
|
|
using (Profiler.TraceMethod<MongoContentRepository>()) |
|
|
|
{ |
|
|
|
await contentsDraft.QueryScheduledWithoutDataAsync(now, callback); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public Task ClearAsync() |
|
|
|
|