Skip to content

Commit

Permalink
docs: 📝 update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
dennemark committed Aug 8, 2024
1 parent dd0bfec commit 1b3dc22
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,15 @@ const result = await caslClient
Mutations will only run, if abilities allow it.

```ts
const { can, build } = abilityBuilder();
can("update", "Post");
cannot("update", "Post", "text");
const caslClient = prismaClient.$extends(useCaslAbilities(build));
function builderFactory() {
const builder = abilityBuilder();

const { can, build } = builder;
can("update", "Post");
cannot("update", "Post", "text");
return builder;
}
const caslClient = prismaClient.$extends(useCaslAbilities(builderFactory));
const result = await caslClient.post.update({
data: { text: "-" },
where: { id: 0 },
Expand Down

0 comments on commit 1b3dc22

Please sign in to comment.