Skip to content

Commit

Permalink
Make findMany return a non-nullable array (#312)
Browse files Browse the repository at this point in the history
* Make findMany return a non-nullable array

* Update graphql-modules
  • Loading branch information
f8k8 authored Aug 29, 2023
1 parent ad1fa69 commit 68fa795
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function createQueriesAndMutations(

if (!exclude.includes('findMany')) {
operations.queries.type += `
findMany${name}(${await args('findMany')}): [${modelName}!]`;
findMany${name}(${await args('findMany')}): [${modelName}!]!`;
operations.queries.resolver += `
findMany${name}: (_parent, args, { injector }: GraphQLModules.Context) => {
return injector.get(PrismaProvider).${model}.findMany(args);
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/src/sdl/CreateQueriesAndMutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export async function createQueriesAndMutations(

if (!exclude.includes('findMany')) {
operations.queries.type += `
findMany${name}(${await args('findMany')}): [${modelName}!]`;
findMany${name}(${await args('findMany')}): [${modelName}!]!`;
operations.queries.resolver += `
findMany${name}: (_parent, args, {${prismaName}}) => {
return ${prismaName}.${model}.findMany(args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default gql\`
take: Int
skip: Int
distinct: [UserScalarFieldEnum]
): [User!]
): [User!]!
aggregateUser(
where: UserWhereInput
orderBy: [UserOrderByWithRelationInput]
Expand Down Expand Up @@ -176,7 +176,7 @@ export default gql\`
take: Int
skip: Int
distinct: [PostScalarFieldEnum]
): [Post!]
): [Post!]!
findManyPostCount(
where: PostWhereInput
orderBy: [PostOrderByWithRelationInput]
Expand Down Expand Up @@ -294,7 +294,7 @@ export default gql\`
take: Int
skip: Int
distinct: [UserScalarFieldEnum]
): [User!]
): [User!]!
findManyUserCount(
where: UserWhereInput
orderBy: [UserOrderByWithRelationInput]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default gql\`
take: Int
skip: Int
distinct: [PostScalarFieldEnum]
): [Post!]
): [Post!]!
aggregatePost(
where: PostWhereInput
orderBy: [PostOrderByWithRelationInput]
Expand Down Expand Up @@ -217,7 +217,7 @@ export default gql\`
take: Int
skip: Int
distinct: [UserScalarFieldEnum]
): [User!]
): [User!]!
aggregateUser(
where: UserWhereInput
orderBy: [UserOrderByWithRelationInput]
Expand Down Expand Up @@ -354,7 +354,7 @@ export default gql\`
take: Int
skip: Int
distinct: [PostScalarFieldEnum]
): [Post!]
): [Post!]!
findManyPostCount(
where: PostWhereInput
orderBy: [PostOrderByWithRelationInput]
Expand Down Expand Up @@ -493,7 +493,7 @@ export default gql\`
take: Int
skip: Int
distinct: [UserScalarFieldEnum]
): [User!]
): [User!]!
findManyUserCount(
where: UserWhereInput
orderBy: [UserOrderByWithRelationInput]
Expand Down

0 comments on commit 68fa795

Please sign in to comment.