Skip to content

Commit

Permalink
Add a flag to enrich required fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle committed Aug 15, 2024
1 parent 36a8d24 commit 64dfde1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@ public async Task ExportAsync(ISyncService sync, SyncOptions options, ISession s
var schemas = await session.Client.Schemas.GetSchemasAsync();
var schemaMap = schemas.Items.ToDictionary(x => x.Id, x => x.Name);

var context = QueryContext.Default.Unpublished().IgnoreFallback();
var context =
QueryContext.Default
.Unpublished()
.WithHeaderHandler(request =>
{
request.Headers.TryAddWithoutValidation("X-NoDefaults", "1");
})
.IgnoreFallback();

foreach (var schema in schemas.Items)
{
Expand Down
12 changes: 11 additions & 1 deletion cli/Squidex.CLI/Squidex.CLI/Commands/App_Contents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,14 @@ async Task BulkUpdateAsync()

var request = new BulkUpdate
{
Jobs = idsRequest.Select(x => new BulkUpdateJob { Id = x, Type = BulkUpdateType.EnrichDefaults }).ToList()
Jobs = idsRequest
.Select(x => new BulkUpdateJob
{
Id = x,
Type = BulkUpdateType.EnrichDefaults
})
.ToList(),
EnrichRequiredFields = arguments.RequiredFields,
};

await session.Client.DynamicContents(arguments.Schema).BulkUpdateAsync(request);
Expand Down Expand Up @@ -445,6 +452,9 @@ public sealed class EnrichDefaultsArguments : AppArguments
[Option('u', "unpublished", Description = "Handle unpublished content.")]
public bool Unpublished { get; set; }

[Option("required-fields", Description = "Also enrich required fields.")]
public bool RequiredFields { get; set; }

public sealed class Validator : AbstractValidator<EnrichDefaultsArguments>
{
}
Expand Down

0 comments on commit 64dfde1

Please sign in to comment.