I had written the following controller to filter a find request based on relations with an authenticated user. The filter no longer works after updating to Strapi 4.15.5
I now recieve an error saying the user parameter (the one in the filters) is invalid. Why is this the case, and how can I solve this issue in the new strapi version ?
Controller:
async find(ctx) {
const authorizationHeader = ctx.headers.authorization;
if (!authorizationHeader) {
return ctx.badRequest('Authorization header is required');
}
const [scheme, token] = authorizationHeader.split(' ');
const decodedToken = jwt.jwtDecode(token);
ctx.query = {
filters: {
user: {
id: {
$eq: decodedToken.id
}
}
}
}
const { data, meta } = await super.find(ctx);
return { data, meta}
},