Hi!
I am struggling with populating my API response correctly.
I am creating a custom controller to return a list of posts. Attached to each post should be the post’s category, as well as the likes, the post received. Attached to each like in turn, should be the ID of the user, that made the like.
Now i tried the following:
let data = await strapi.entityService.findMany('api::post.post', {
populate: {
post_category: true,
post_likes: {
populate:
{
user_permissions_user: true,
},
}
},
});
First of all that doesn’t work, I don’t receive the User Objects back with my response (it doesn’t get populated). Second of all I believe there is a select-feature i could use, so that i don’t get the entire user-object, but could maybe really just add the ID to the post_like ID in a field of it’s own.
Could someone please help me here, I’ve been trying for hours now with docu and google to fix this, but I’m really struggling
PS: I’ve made sure permissions are set correctly!
Cheers,
Max