Skip to content

Commit

Permalink
reworked bulkReplaceRelations_* GraphQL endpoint: added explicit rele…
Browse files Browse the repository at this point in the history
…vantCIIDs argument
  • Loading branch information
maximiliancsuk committed May 16, 2024
1 parent 4ce6921 commit a86d957
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,8 @@ public void Init(GraphQLMutation tet, TypeContainer typeContainer)
.Arguments(
new QueryArgument<NonNullGraphType<ListGraphType<StringGraphType>>> { Name = "layers" },
new QueryArgument<NonNullGraphType<StringGraphType>> { Name = "writeLayer" },
new QueryArgument<NonNullGraphType<ListGraphType<CIIDAndUpsertRelationsOnlyInputType>>> { Name = "input" }
new QueryArgument<NonNullGraphType<ListGraphType<CIIDAndUpsertRelationsOnlyInputType>>> { Name = "input" },
new QueryArgument<NonNullGraphType<ListGraphType<GuidGraphType>>> { Name = "relevantCIIDs" }
)
.ResolveAsync(async context =>
{
Expand All @@ -874,9 +875,7 @@ public void Init(GraphQLMutation tet, TypeContainer typeContainer)
var timeThreshold = userContext.GetTimeThreshold(context.Path);
var trans = userContext.Transaction;
// TODO: this could be done faster, because we only need the CIIDs that are TEs, not the TEs themselves at this point
var relevantETs = await elementTypeContainer.TraitEntityModel.GetByCIID(AllCIIDsSelection.Instance, layerset, trans, timeThreshold);
var relevantCIIDs = relevantETs.Keys.ToHashSet();
var relevantCIIDs = context.GetArgument<Guid[]>("relevantCIIDs")!.ToHashSet(); // NOTE: force distinct by turning it into a hashset
foreach (var relevantCIID in relevantCIIDs)
if (await authzFilterManager.ApplyPreFilterForMutation(new PreUpsertContextForTraitEntities(relevantCIID, elementTypeContainer.Trait), writeLayerID, userContext, context.Path) is AuthzFilterResultDeny d)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ public async Task TestBasics()
input: [
{baseCIID: ""e4125f12-0257-4835-aa25-b8f83a64a38c"", relatedCIIDs: [""eb3772f6-6d3e-426b-86f3-1ff8ba165d0c""]},
{baseCIID: ""eb3772f6-6d3e-426b-86f3-1ff8ba165d0c"", relatedCIIDs: [""e4125f12-0257-4835-aa25-b8f83a64a38c"", ""fb3772f6-6d3e-426b-86f3-1ff8ba165d0c""]}]
relevantCIIDs: [""e4125f12-0257-4835-aa25-b8f83a64a38c"", ""eb3772f6-6d3e-426b-86f3-1ff8ba165d0c""]
) {
isNoOp
}
Expand All @@ -144,6 +145,7 @@ public async Task TestBasics()
input: [
{baseCIID: ""e4125f12-0257-4835-aa25-b8f83a64a38c"", relatedCIIDs: [""eb3772f6-6d3e-426b-86f3-1ff8ba165d0c""]},
{baseCIID: ""eb3772f6-6d3e-426b-86f3-1ff8ba165d0c"", relatedCIIDs: [""e4125f12-0257-4835-aa25-b8f83a64a38c"", ""fb3772f6-6d3e-426b-86f3-1ff8ba165d0c""]}]
relevantCIIDs: [""e4125f12-0257-4835-aa25-b8f83a64a38c"", ""eb3772f6-6d3e-426b-86f3-1ff8ba165d0c""]
) {
isNoOp
}
Expand All @@ -163,6 +165,7 @@ public async Task TestBasics()
input: [
{baseCIID: ""eb3772f6-6d3e-426b-86f3-1ff8ba165d0c"", relatedCIIDs: [""e4125f12-0257-4835-aa25-b8f83a64a38c""]},
{baseCIID: ""fb3772f6-6d3e-426b-86f3-1ff8ba165d0c"", relatedCIIDs: [""eb3772f6-6d3e-426b-86f3-1ff8ba165d0c"", ""e4125f12-0257-4835-aa25-b8f83a64a38c""]}]
relevantCIIDs: [""e4125f12-0257-4835-aa25-b8f83a64a38c"", ""eb3772f6-6d3e-426b-86f3-1ff8ba165d0c"", ""fb3772f6-6d3e-426b-86f3-1ff8ba165d0c""]
) {
isNoOp
}
Expand Down

0 comments on commit a86d957

Please sign in to comment.