Browse Source

Fix simple mistake in config and OpenAPI

pull/1269/head
Sebastian Stehle 2 months ago
parent
commit
7212938f2e
  1. 2
      backend/src/Squidex.Data.MongoDb/ServiceExtensions.cs
  2. 2
      backend/src/Squidex/Areas/Api/Controllers/Contents/ContentsSharedController.cs
  3. 8
      backend/src/Squidex/Areas/Api/Controllers/Contents/Generator/OperationBuilder.cs
  4. 6
      backend/src/Squidex/Areas/Api/Controllers/Contents/Generator/SchemasOpenApiGenerator.cs
  5. 26
      backend/src/Squidex/Areas/Api/Controllers/Contents/Models/AllContentsByGetDto.cs
  6. 4
      backend/src/Squidex/Areas/Api/Controllers/Contents/Models/AllContentsByPostDto.cs

2
backend/src/Squidex.Data.MongoDb/ServiceExtensions.cs

@ -228,7 +228,7 @@ public static class ServiceExtensions
shardKey => ActivatorUtilities.CreateInstance<AtlasTextIndex>(c, shardKey));
}).AsOptional<ITextIndex>().As<IDeleter>();
}
else if (config.GetValue<bool>("store:mongoDb:dpcumentDb"))
else if (config.GetValue<bool>("store:mongoDb:documentDb"))
{
services.AddSingletonAs(c =>
{

2
backend/src/Squidex/Areas/Api/Controllers/Contents/ContentsSharedController.cs

@ -142,7 +142,7 @@ public sealed class ContentsSharedController(
[AcceptHeader.Unpublished]
public async Task<IActionResult> 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(() =>
{

8
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);
}

6
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.");

26
backend/src/Squidex/Areas/Api/Controllers/Contents/Models/AllContentsByGetDto.cs

@ -25,15 +25,35 @@ public sealed class AllContentsByGetDto
public string? Ids { get; set; }
/// <summary>
/// The start of the schedule.
/// The start time of the scheduled content period (see scheduleTo).
/// </summary>
[FromQuery(Name = "scheduleFrom")]
public Instant? ScheduledFrom { get; set; }
[Obsolete("Renamed to 'scheduledFrom'")]
public Instant? ScheduleFrom
{
set => ScheduledFrom = value;
}
/// <summary>
/// The end of the schedule.
/// The start time of the scheduled content period (see scheduleFrom).
/// </summary>
[FromQuery(Name = "scheduleTo")]
[Obsolete("Renamed to 'scheduledTo'")]
public Instant? ScheduleTo
{
set => ScheduledTo = value;
}
/// <summary>
/// The start time of the scheduled content period (see scheduledTo).
/// </summary>
[FromQuery(Name = "scheduledFrom")]
public Instant? ScheduledFrom { get; set; }
/// <summary>
/// The end time of the scheduled content period (see scheduledFrom).
/// </summary>
[FromQuery(Name = "scheduledTo")]
public Instant? ScheduledTo { get; set; }
/// <summary>

4
backend/src/Squidex/Areas/Api/Controllers/Contents/Models/AllContentsByPostDto.cs

@ -25,12 +25,12 @@ public sealed class AllContentsByPostDto
public DomainId[]? Ids { get; set; }
/// <summary>
/// The start of the schedule.
/// The start time of the scheduled content period (see scheduledTo).
/// </summary>
public Instant? ScheduledFrom { get; set; }
/// <summary>
/// The end of the schedule.
/// The end time of the scheduled content period (see scheduledFrom).
/// </summary>
public Instant? ScheduledTo { get; set; }

Loading…
Cancel
Save