olivierwilkinson / prisma-extension-soft-delete

Prisma extension for adding soft delete to Prisma models, even when using nested queries
Apache License 2.0
109 stars 16 forks source link

fix: allow override deleted field in findUnique #28

Open saputradharma opened 2 months ago

saputradharma commented 2 months ago

Allow override deleted field in findUnique and findUniqueOrThrow

The existing findFirst and findFirstOrThrow already have this override logic:

{
  ...
  where: {
    ...params.args?.where,
    // allow overriding the deleted field in where
    [config.field]:
      params.args?.where?.[config.field] || config.createValue(false),
  },
  ...
}

But findUnique and findUniqueOrThrow don't have it. The findUnique and findUniqueOrThrow called findFirst and findFirstOrThrow internally but the override params not passed to the internal call. This PR try to fix this issue.