I didn't test this code but it should work or be very close to work. You might need to adapt something.
calendarPeopleId is the property we want to filter by. Open devtools and check the Calendar data. We can see that we want all calendar where the calendarPeopleId is from the person we want.
personId is the variable where we saved this person id. From router.query.
The end result
We should show all calendar days from this user.
User page Jose:
We should have a page to list all the person information plus all the days where he worked.
The URL will be
/people/[id]
This has to show the user card, like in the edit page. After, a list of all the days where this user worked.
Something like the calendar page but only for days where this user worked.
The query should be similar to the calendar one, but with some condition to filter only this user id.
Useful example for documentation
https://docs.amplify.aws/lib/datastore/data-access/q/platform/js/#predicates
Here they are getting all Posts (Articles) where the
rating
is greater (gt
) than 4.We want something similar but we want all
Calendar
wherepeople id
is the id of this person.Without testing, it will be something similar to
I didn't test this code but it should work or be very close to work. You might need to adapt something.
calendarPeopleId
is the property we want to filter by. Open devtools and check the Calendar data. We can see that we want all calendar where thecalendarPeopleId
is from the person we want.personId
is the variable where we saved this person id. Fromrouter.query
.The end result
We should show all calendar days from this user. User page Jose: