Skip to content

Commit

Permalink
BUG: read auth annotation from GraphQL type, not from Prisma model
Browse files Browse the repository at this point in the history
This brings the list constraint logic in line with how other middleware work.
This is important e.g. for union types which do not exist in Prisma model
  • Loading branch information
dimaip committed Nov 3, 2021
1 parent 62b11ce commit 192ffe3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,12 @@ export class PrismaSelect {
* @NOTE-DP: root level `where` clause. Only for lists
*/
if (isRootList) {
const where = getListWhereConstrains(modelName, model?.documentation, this.options, this.context)
const where = getListWhereConstrains(
modelName,
this.info.schema.getType(modelName)?.description || '',
this.options,
this.context
)
if (where) {
filteredObject.where = where
}
Expand All @@ -231,7 +236,7 @@ export class PrismaSelect {
if (field.isList) {
const where = getListWhereConstrains(
field.type,
this.model(field.type)?.documentation,
this.info.schema.getType(field.type)?.description || '',
this.options,
this.context
)
Expand Down

0 comments on commit 192ffe3

Please sign in to comment.