|
|
@ -20,6 +20,7 @@ using Squidex.Domain.Apps.Entities.Contents.Edm; |
|
|
using Squidex.Domain.Apps.Entities.Contents.Repositories; |
|
|
using Squidex.Domain.Apps.Entities.Contents.Repositories; |
|
|
using Squidex.Domain.Apps.Entities.Schemas; |
|
|
using Squidex.Domain.Apps.Entities.Schemas; |
|
|
using Squidex.Infrastructure; |
|
|
using Squidex.Infrastructure; |
|
|
|
|
|
using Squidex.Infrastructure.Log; |
|
|
using Squidex.Infrastructure.Reflection; |
|
|
using Squidex.Infrastructure.Reflection; |
|
|
using Squidex.Infrastructure.Security; |
|
|
using Squidex.Infrastructure.Security; |
|
|
|
|
|
|
|
|
@ -71,6 +72,8 @@ namespace Squidex.Domain.Apps.Entities.Contents |
|
|
|
|
|
|
|
|
var schema = await GetSchemaAsync(app, schemaIdOrName); |
|
|
var schema = await GetSchemaAsync(app, schemaIdOrName); |
|
|
|
|
|
|
|
|
|
|
|
using (Profiler.TraceMethod<ContentQueryService>()) |
|
|
|
|
|
{ |
|
|
var isVersioned = version > EtagVersion.Empty; |
|
|
var isVersioned = version > EtagVersion.Empty; |
|
|
var isFrontend = IsFrontendClient(user); |
|
|
var isFrontend = IsFrontendClient(user); |
|
|
|
|
|
|
|
|
@ -88,6 +91,7 @@ namespace Squidex.Domain.Apps.Entities.Contents |
|
|
|
|
|
|
|
|
return TransformContent(app, schema, user, content, isFrontend, isVersioned); |
|
|
return TransformContent(app, schema, user, content, isFrontend, isVersioned); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public async Task<IResultList<IContentEntity>> QueryAsync(IAppEntity app, string schemaIdOrName, ClaimsPrincipal user, bool archived, string query) |
|
|
public async Task<IResultList<IContentEntity>> QueryAsync(IAppEntity app, string schemaIdOrName, ClaimsPrincipal user, bool archived, string query) |
|
|
{ |
|
|
{ |
|
|
@ -97,6 +101,8 @@ namespace Squidex.Domain.Apps.Entities.Contents |
|
|
|
|
|
|
|
|
var schema = await GetSchemaAsync(app, schemaIdOrName); |
|
|
var schema = await GetSchemaAsync(app, schemaIdOrName); |
|
|
|
|
|
|
|
|
|
|
|
using (Profiler.TraceMethod<ContentQueryService>("QueryAsyncByQuery")) |
|
|
|
|
|
{ |
|
|
var isFrontend = IsFrontendClient(user); |
|
|
var isFrontend = IsFrontendClient(user); |
|
|
|
|
|
|
|
|
var parsedQuery = ParseQuery(app, query, schema); |
|
|
var parsedQuery = ParseQuery(app, query, schema); |
|
|
@ -106,6 +112,7 @@ namespace Squidex.Domain.Apps.Entities.Contents |
|
|
|
|
|
|
|
|
return TransformContents(app, schema, user, contents, false, isFrontend); |
|
|
return TransformContents(app, schema, user, contents, false, isFrontend); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public async Task<IResultList<IContentEntity>> QueryAsync(IAppEntity app, string schemaIdOrName, ClaimsPrincipal user, bool archived, HashSet<Guid> ids) |
|
|
public async Task<IResultList<IContentEntity>> QueryAsync(IAppEntity app, string schemaIdOrName, ClaimsPrincipal user, bool archived, HashSet<Guid> ids) |
|
|
{ |
|
|
{ |
|
|
@ -116,6 +123,8 @@ namespace Squidex.Domain.Apps.Entities.Contents |
|
|
|
|
|
|
|
|
var schema = await GetSchemaAsync(app, schemaIdOrName); |
|
|
var schema = await GetSchemaAsync(app, schemaIdOrName); |
|
|
|
|
|
|
|
|
|
|
|
using (Profiler.TraceMethod<ContentQueryService>("QueryAsyncByIds")) |
|
|
|
|
|
{ |
|
|
var isFrontend = IsFrontendClient(user); |
|
|
var isFrontend = IsFrontendClient(user); |
|
|
|
|
|
|
|
|
var parsedStatus = ParseStatus(isFrontend, archived); |
|
|
var parsedStatus = ParseStatus(isFrontend, archived); |
|
|
@ -124,6 +133,7 @@ namespace Squidex.Domain.Apps.Entities.Contents |
|
|
|
|
|
|
|
|
return TransformContents(app, schema, user, contents, false, isFrontend); |
|
|
return TransformContents(app, schema, user, contents, false, isFrontend); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private IContentEntity TransformContent(IAppEntity app, ISchemaEntity schema, ClaimsPrincipal user, |
|
|
private IContentEntity TransformContent(IAppEntity app, ISchemaEntity schema, ClaimsPrincipal user, |
|
|
IContentEntity content, |
|
|
IContentEntity content, |
|
|
@ -147,6 +157,8 @@ namespace Squidex.Domain.Apps.Entities.Contents |
|
|
IEnumerable<IContentEntity> contents, |
|
|
IEnumerable<IContentEntity> contents, |
|
|
bool isTypeChecking, |
|
|
bool isTypeChecking, |
|
|
bool isFrontendClient) |
|
|
bool isFrontendClient) |
|
|
|
|
|
{ |
|
|
|
|
|
using (Profiler.TraceMethod<ContentQueryService>()) |
|
|
{ |
|
|
{ |
|
|
var scriptText = schema.ScriptQuery; |
|
|
var scriptText = schema.ScriptQuery; |
|
|
|
|
|
|
|
|
@ -174,8 +186,11 @@ namespace Squidex.Domain.Apps.Entities.Contents |
|
|
yield return result; |
|
|
yield return result; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private ODataUriParser ParseQuery(IAppEntity app, string query, ISchemaEntity schema) |
|
|
private ODataUriParser ParseQuery(IAppEntity app, string query, ISchemaEntity schema) |
|
|
|
|
|
{ |
|
|
|
|
|
using (Profiler.TraceMethod<ContentQueryService>()) |
|
|
{ |
|
|
{ |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
@ -188,6 +203,7 @@ namespace Squidex.Domain.Apps.Entities.Contents |
|
|
throw new ValidationException($"Failed to parse query: {ex.Message}", ex); |
|
|
throw new ValidationException($"Failed to parse query: {ex.Message}", ex); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public async Task<ISchemaEntity> GetSchemaAsync(IAppEntity app, string schemaIdOrName) |
|
|
public async Task<ISchemaEntity> GetSchemaAsync(IAppEntity app, string schemaIdOrName) |
|
|
{ |
|
|
{ |
|
|
|