omar-dulaimi / trpc-shield

🛡 A tRPC tool to ease the creation of permission layer.
MIT License
402 stars 10 forks source link

Unclear how to access "parent" #16

Closed erickreutz closed 1 year ago

erickreutz commented 1 year ago

In the examples on the home page you have the following as a rule:

const isOwner = rule<Context>()(async (ctx, type, path, input, rawInput) => {
  return ctx.user.items.some((id) => id === parent.id)
})

Where is parent coming from? How to use trpc-shield to define a rule and access the object or parent in question is unclear.

omar-dulaimi commented 1 year ago

Oh I must have missed that after forking from the original grpahgl shield repo. Thanks for bringing it to my attention, will fix it soon