From 7212938f2ef1bc33fdc4ef998f77f7768ea2cbdb Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Wed, 26 Nov 2025 10:54:01 +0100 Subject: [PATCH] Fix simple mistake in config and OpenAPI --- .../Squidex.Data.MongoDb/ServiceExtensions.cs | 2 +- .../Contents/ContentsSharedController.cs | 2 +- .../Contents/Generator/OperationBuilder.cs | 8 +++--- .../Generator/SchemasOpenApiGenerator.cs | 6 ++++- .../Contents/Models/AllContentsByGetDto.cs | 26 ++++++++++++++++--- .../Contents/Models/AllContentsByPostDto.cs | 4 +-- 6 files changed, 35 insertions(+), 13 deletions(-) diff --git a/backend/src/Squidex.Data.MongoDb/ServiceExtensions.cs b/backend/src/Squidex.Data.MongoDb/ServiceExtensions.cs index a3b226284..1e07fff3e 100644 --- a/backend/src/Squidex.Data.MongoDb/ServiceExtensions.cs +++ b/backend/src/Squidex.Data.MongoDb/ServiceExtensions.cs @@ -228,7 +228,7 @@ public static class ServiceExtensions shardKey => ActivatorUtilities.CreateInstance(c, shardKey)); }).AsOptional().As(); } - else if (config.GetValue("store:mongoDb:dpcumentDb")) + else if (config.GetValue("store:mongoDb:documentDb")) { services.AddSingletonAs(c => { diff --git a/backend/src/Squidex/Areas/Api/Controllers/Contents/ContentsSharedController.cs b/backend/src/Squidex/Areas/Api/Controllers/Contents/ContentsSharedController.cs index f46499401..141ecabdb 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Contents/ContentsSharedController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Contents/ContentsSharedController.cs @@ -142,7 +142,7 @@ public sealed class ContentsSharedController( [AcceptHeader.Unpublished] public async Task GetAllContents(string app, AllContentsByGetDto query) { - var contents = await contentQuery.QueryAsync(Context, (query ?? new AllContentsByGetDto()).ToQuery(Request), HttpContext.RequestAborted); + var contents = await contentQuery.QueryAsync(Context, query?.ToQuery(Request) ?? Q.Empty, HttpContext.RequestAborted); var response = Deferred.AsyncResponse(() => { diff --git a/backend/src/Squidex/Areas/Api/Controllers/Contents/Generator/OperationBuilder.cs b/backend/src/Squidex/Areas/Api/Controllers/Contents/Generator/OperationBuilder.cs index ae6fa0392..e16ec3db8 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Contents/Generator/OperationBuilder.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Contents/Generator/OperationBuilder.cs @@ -82,21 +82,19 @@ internal sealed class OperationBuilder(OperationsBuilder operations, OpenApiOper public OperationBuilder HasQueryOptions(bool supportSearch) { - operation.AddQuery(true); - + operation.AddQuery(supportSearch); return this; } public OperationBuilder Deprecated() { operation.IsDeprecated = true; - return this; } - public OperationBuilder HasQuery(string name, JsonObjectType type, string description) + public OperationBuilder HasQuery(string name, JsonObjectType type, string description, string? format = null) { - var jsonSchema = new JsonSchema { Type = type }; + var jsonSchema = new JsonSchema { Type = type, Format = format }; return AddParameter(name, jsonSchema, OpenApiParameterKind.Query, description); } diff --git a/backend/src/Squidex/Areas/Api/Controllers/Contents/Generator/SchemasOpenApiGenerator.cs b/backend/src/Squidex/Areas/Api/Controllers/Contents/Generator/SchemasOpenApiGenerator.cs index fb875ce78..829c1a4ba 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Contents/Generator/SchemasOpenApiGenerator.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Contents/Generator/SchemasOpenApiGenerator.cs @@ -79,7 +79,11 @@ public sealed class SchemasOpenApiGenerator( .RequirePermission(PermissionIds.AppContentsReadOwn) .Operation("Query") .OperationSummary("Query contents across all schemas.") - .HasQuery("ids", JsonObjectType.String, "Comma-separated list of content IDs.") + .HasQueryOptions(true) + .HasQuery("referencing", JsonObjectType.String, "The ID of the referencing content item.") + .HasQuery("references", JsonObjectType.String, "The ID of the reference content item.") + .HasQuery("scheduledFrom", JsonObjectType.String, "The start time of the scheduled content period (see scheduledTo)", JsonFormatStrings.DateTime) + .HasQuery("scheduledTo", JsonObjectType.String, " The end time of the scheduled content period (see scheduledFrom).", JsonFormatStrings.DateTime) .Responds(200, "Content items retrieved.", builder.ContentsSchema) .Responds(400, "Query not valid."); diff --git a/backend/src/Squidex/Areas/Api/Controllers/Contents/Models/AllContentsByGetDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Contents/Models/AllContentsByGetDto.cs index ce955ad63..33cf9e3ac 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Contents/Models/AllContentsByGetDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Contents/Models/AllContentsByGetDto.cs @@ -25,15 +25,35 @@ public sealed class AllContentsByGetDto public string? Ids { get; set; } /// - /// The start of the schedule. + /// The start time of the scheduled content period (see scheduleTo). /// [FromQuery(Name = "scheduleFrom")] - public Instant? ScheduledFrom { get; set; } + [Obsolete("Renamed to 'scheduledFrom'")] + public Instant? ScheduleFrom + { + set => ScheduledFrom = value; + } /// - /// The end of the schedule. + /// The start time of the scheduled content period (see scheduleFrom). /// [FromQuery(Name = "scheduleTo")] + [Obsolete("Renamed to 'scheduledTo'")] + public Instant? ScheduleTo + { + set => ScheduledTo = value; + } + + /// + /// The start time of the scheduled content period (see scheduledTo). + /// + [FromQuery(Name = "scheduledFrom")] + public Instant? ScheduledFrom { get; set; } + + /// + /// The end time of the scheduled content period (see scheduledFrom). + /// + [FromQuery(Name = "scheduledTo")] public Instant? ScheduledTo { get; set; } /// diff --git a/backend/src/Squidex/Areas/Api/Controllers/Contents/Models/AllContentsByPostDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Contents/Models/AllContentsByPostDto.cs index 26c622981..7173a068b 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Contents/Models/AllContentsByPostDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Contents/Models/AllContentsByPostDto.cs @@ -25,12 +25,12 @@ public sealed class AllContentsByPostDto public DomainId[]? Ids { get; set; } /// - /// The start of the schedule. + /// The start time of the scheduled content period (see scheduledTo). /// public Instant? ScheduledFrom { get; set; } /// - /// The end of the schedule. + /// The end time of the scheduled content period (see scheduledFrom). /// public Instant? ScheduledTo { get; set; }