Skip to content
Open
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
1 change: 1 addition & 0 deletions src/Core/Models/GraphQLFilterParsers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ public Predicate Parse(

cosmosQueryStructure.DatabaseObject.Name = sourceName;
cosmosQueryStructure.SourceAlias = sourceAlias;
cosmosQueryStructure.EntityName = entityName;
}
}
}
Expand Down
25 changes: 25 additions & 0 deletions src/Service.Tests/CosmosTests/QueryFilterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,31 @@ public async Task TestFilterWithEntityNameAlias()
await ExecuteAndValidateResult(_graphQLQueryName, gqlQuery, dbQuery);
}

/// <summary>
/// Test filters on two different nested objects simultaneously
/// </summary>
[TestMethod]
public async Task TestFilterOnTwoDifferentNestedObjects()
{
string gqlQuery = @"{
planets(first: 10, " + QueryBuilder.FILTER_FIELD_NAME + @" : {
character: { name: { eq: ""planet character"" } },
earth: { type: { eq: ""earth4"" } }
})
{
items {
id
name
}
}
}";

string dbQuery = "SELECT c.id, c.name FROM c " +
"WHERE c.character.name = \"planet character\" AND c.earth.type = \"earth4\"";

await ExecuteAndValidateResult(_graphQLQueryName, gqlQuery, dbQuery);
}

/// <summary>
/// For "item-level-permission-role" role, DB policies are defined. This test confirms that all the DB policies are considered.
/// For the reference, Below conditions are applied for an Entity in Db Config file.
Expand Down