Skip to content

updateAndFetchById and patchAndFetchById with $relatedQuery #189

@jkirkwood

Description

@jkirkwood

I have two models in my application: Groups and Users. A Group 'owns' several Users.

In my application I am using the following code with the intent of limiting the updateAndFetchById method to a specific group.

myGroup
  .$relatedQuery('users')
  .updateAndFetchById(userId, request)
  .then(function(user) {
    ...
  });

The update operation works as expected: the user with the specified userId will only be updated if it also has groupId equal to the id of myGroup.

The problem in that the fetch operation will always return the user with the matching userId regardless of whether its groupId matches myGroup or not. Is this the intended behavior?

I noticed the same issue with patchAndFetchById.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions