Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Apps.Contentful/Actions/EntryActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,11 @@ private static void ApplyListEntriesRequestFilters(NameValueCollection queryStri
{
queryString.Add("metadata.tags.sys.id[in]", string.Join(",", request.Tags));
}

if (!string.IsNullOrWhiteSpace(request.UpdatedBy))
{
queryString.Add("sys.updatedBy.sys.id", request.UpdatedBy);
}

if (request.ExcludeTags is not null && request.ExcludeTags.Any())
{
Expand Down
2 changes: 1 addition & 1 deletion Apps.Contentful/Apps.Contentful.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<Product>Contentful</Product>
<Description>The headless content management system</Description>
<Version>1.8.16</Version>
<Version>1.8.17</Version>
<AssemblyName>Apps.Contentful</AssemblyName>
</PropertyGroup>

Expand Down
6 changes: 5 additions & 1 deletion Apps.Contentful/Models/Requests/ListEntriesRequest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Apps.Contentful.DataSourceHandlers.Tags;
using Apps.Contentful.DataSourceHandlers;
using Apps.Contentful.DataSourceHandlers.Tags;
using Apps.Contentful.Models.Identifiers;
using Blackbird.Applications.Sdk.Common;
using Blackbird.Applications.Sdk.Common.Dynamic;
Expand Down Expand Up @@ -42,4 +43,7 @@ public class ListEntriesRequest : ContentModelOptionalIdentifier

[Display("Search term", Description = "Full‑text search across all text and symbol fields")]
public string? SearchTerm { get; set; }

[Display("Updated by"), DataSource(typeof(UserDataSourceHandler))]
public string? UpdatedBy { get; set; }
}
6 changes: 6 additions & 0 deletions Tests.Contentful/Base/TestBase.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Blackbird.Applications.Sdk.Common.Authentication;
using Blackbird.Applications.Sdk.Common.Invocation;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;

namespace Tests.Contentful.Base;

Expand Down Expand Up @@ -30,4 +31,9 @@ protected TestBase()

FileManager = new FileManager();
}

protected static void PrintJsonResult(object result)
{
Console.WriteLine(JsonConvert.SerializeObject(result, Formatting.Indented));
}
}
14 changes: 14 additions & 0 deletions Tests.Contentful/DataHandlerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,18 @@ public async Task LocaleDataSourceHandler_ReturnsLocales()
Assert.IsNotNull(result);
Console.WriteLine(JsonConvert.SerializeObject(result, Formatting.Indented));
}

[TestMethod]
public async Task UserDataSourceHandler_ReturnsUsers()
{
// Arrange
var handler = new UserDataSourceHandler(InvocationContext);

// Act
var result = await handler.GetDataAsync(new(), default);

// Assert
Assert.IsNotNull(result);
PrintJsonResult(result);
}
}
7 changes: 2 additions & 5 deletions Tests.Contentful/EntryActionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,11 @@ public async Task ListEntries_NotExistingEnvironment_ShouldFailWithException()
public async Task ListEntries_ValidEnvironment_ShouldReturnAllEntries()
{
var entryActions = new EntryActions(InvocationContext, FileManager);
var listEntriesRequest = new ListEntriesRequest { Environment = "dev", SearchTerm = "The perfect partner" };
var listEntriesRequest = new ListEntriesRequest { Environment = "master", UpdatedBy = "5UuNOI1TXxCkHgBChqQP9z" };

var entriesResponse = await entryActions.ListEntries(listEntriesRequest);

foreach (var entry in entriesResponse.Entries)
{
Console.WriteLine($"{entry.ContentId}");
}
PrintJsonResult(entriesResponse);
}

[TestMethod]
Expand Down