Skip to content

Commit

Permalink
chore: Remove updateAndFind
Browse files Browse the repository at this point in the history
  • Loading branch information
sharat87 committed Jun 12, 2024
1 parent 69b63fa commit b4d3023
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,9 @@ public Mono<T> updateById(@NonNull String id, @NonNull T resource, AclPermission
// Set policies to null in the update object
resource.setPolicies(null);

return queryBuilder()
.byId(id)
.permission(permission)
.updateFirstAndFind(buildUpdateFromSparseResource(resource));
final QueryAllParams<T> q = queryBuilder().byId(id).permission(permission);

return q.updateFirst(buildUpdateFromSparseResource(resource)).then(Mono.defer(q::one));
}

public Mono<Integer> updateByIdWithoutPermissionCheck(@NonNull String id, BridgeUpdate update) {
Expand Down Expand Up @@ -356,19 +355,6 @@ public Mono<Integer> updateExecute(@NonNull QueryAllParams<T> params, @NonNull U
}));
}

public Mono<T> updateExecuteAndFind(@NonNull QueryAllParams<T> params, @NonNull UpdateDefinition update) {
if (QueryAllParams.Scope.ALL.equals(params.getScope())) {
// Not implemented yet, since not needed yet.
return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, "scope"));

} else if (QueryAllParams.Scope.FIRST.equals(params.getScope())) {
return updateExecute(params, update).then(Mono.defer(() -> queryOneExecute(params)));

} else {
return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, "scope"));
}
}

public BridgeUpdate buildUpdateFromSparseResource(T resource) {
// In case the update is not used to update the policies, then set the policies to null to ensure that the
// existing policies are not overwritten.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ public Mono<Integer> updateFirst(@NonNull UpdateDefinition update) {
return repo.updateExecute(this, update);
}

public Mono<T> updateFirstAndFind(@NonNull UpdateDefinition update) {
scope = Scope.FIRST;
return repo.updateExecuteAndFind(this, update);
}

public QueryAllParams<T> criteria(Criteria c) {
if (c == null) {
return this;
Expand Down

0 comments on commit b4d3023

Please sign in to comment.