Many-to-Many Relation with Connection-Resource and Filter


#1

Hi there.
So, I have a Many-to-Many relation of the following resources: “User” and “Job”. And I have a third resource “JobApplication” which connects both resources. The JobApplication resource has an attribute called “status”.

What I want is to request the following case:
Show me all Jobs of a User where the status of his Application is “checked”.

How can I do such a Request?

Something like: /users/1/jobApplications/jobs?filter[jobApplications.status]=checked
But it seems to be wrong.

Best regards


#2

From the documentation, I think that the recommended way to express that filter is

GET /jobs?filter[jobApplications.status]=checked&filter[jobApplications.user]=1

You have to deal with parsing the parameters into some query anyways, it depends on the backend you are using. If you are using a SQL database, this is mainly a matter of building the right INNER JOINs.