How to migrate my 'Is Owner' Policy from v3 to Strapi v4

Answered my own question with:

This lets you create a ‘todo’ and manage in a protected route (without other people seeing your posts)

const { createCoreController } = require("@strapi/strapi").factories;

module.exports = createCoreController(
  "api::connection.connection",
  ({ strapi }) => ({
    async find(ctx) {
      const { user } = ctx.state;

      const entities = await strapi.db
        .query("api::connection.connection")
        .findMany({
          where: {
            links: user,
          },
          populate: true,
        });

      return entities;
    },
  })
);
1 Like