Hey all I have a feature request that I think woul...
# orm-help
b
Hey all I have a feature request that I think would be very powerful (sorry if this is not the right place for this) so say we could pass in the following to any CRUD operation
Copy code
const result = await prisma.user.create({
    data: {
      email: '<mailto:abc@123.com|abc@123.com>',
      firstName: 'abc',
      lastName: 'xyz',
      type: UserType.OWNER,
    },
    context: blah,
  });
context could be of any type so we could then pick that up in the middleware
Copy code
export async function PubSubMiddleWare(
  params: Prisma.MiddlewareParams,
  next: (params: Prisma.MiddlewareParams) => Promise<any>
) {
  const { action, model, args } = params;
  const { context } = args;
  pubsub
      .publish(`${params.model}_changed`, {
        mutation: action,
        model,
        node: result,
        context
      })
}
r
b
thanks
n
This looks interesting! Thanks for creating the Feature Request 🙌