is there a way to show only resources from a given user?
Ive a User Schema and a Items Schema with Ref on User. I only want to show items from the currentAdmin.
Here is my current code:
const customBefore = (request: { query: any }, context: any) => {
const {query = {}} = request
const newQuery = {
...query,
['filters.user']: context.currentAdmin._id
}
request.query = newQuery
return request
}
Im getting TypeError: Cannot read properties of null (reading 'type')
error