Fetching data that belongs to a model 'through' another relationship

Thanks Sunny! Actually I was looking for a way to use the User object in my strapi raw queries. Went on a hunt on Github after seeing this, and found that I can simply use the user object ${ctx.state.user} in the SQL statement itself!

strapi.connections.default.raw(`SELECT author FROM posts WHERE author = ${ctx.state.user.id}`);
1 Like