#community-help

Filtering Data Based on Routes for Job Application

TLDR KARTHICK asked how to filter jobs based on routes. Jason suggested adding a strings[] attribute for saved jobs and using filters for different routes.

Powered by Struct AI
Apr 07, 2023 (8 months ago)
KARTHICK
Photo of md5-9885c2d5db3a85d24bc9c11809bcaf50
KARTHICK
09:57 AM
I have a usecase lets say we have two routes
1. Population of created job
2. Population of saved job
How to filter these data based on the routes.
When user saved the job that need to be removed from normal job routes and it should be populate only in saved job route.
SAVED JOB Route should contain on the saved jobes by specific users. I need some help from anyone to solve this useCase using ts. Kishore Nallan Jason
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
10:24 AM
When a user saves a job, you want to add their ID to a new strings[] attribute in the document called say saved_by_user_ids.

Then to render the saved jobs for a user, you filter by that user’s ID. And to render the normal jobs route, you would apply a filter of saved_by_user_ids:!=user_id
10:25
Jason
10:25 AM
Make sure you use a scoped search api key and exclude_fields and exclude this field from being returned in the API response, to make sure users can’t see each other’s saved jobs
KARTHICK
Photo of md5-9885c2d5db3a85d24bc9c11809bcaf50
KARTHICK
10:36 AM
So saved by user id should be in the same job collection right ???
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
10:47 AM
correct