Closed impact-merlinzerbe closed 6 months ago
This is a bug with @request.data.*
relations resolver. I'll submit a fix sometime later today.
I've pushed a fix in master
and it will be available with the next minor v0.22.3 release a little bit later.
The tests were also updated to cover this use case so it should work correctly now.
Awesome, thanks for the fixing this so fast.
I use PocketBase v0.22.2.
Consider the default
users
collection (with aname
field) and amessages
collection with fieldsto
andfrom
(both single relation tousers
).I use both fields in my API rules, e.g. like this:
The generated SQL is this:
The request fails because of the single
JOIN
on__data_users
. In the in create rule I can work around this by not using the@request.data.
syntax, although I find it more explicit:The corresponding (working) SQL is:
However, in the update rule I need to use the
@request.data.
syntax because I want to filter on the sent data, not the current record data:Similar to the first create rule SQL, this always fails:
How can I filter on the
@request.data.*
fields in the API rules if multiple fields relate to the same collection?