Skip to content

Commit

Permalink
fix(resolver types): use correct output type for aggregation resolvers
Browse files Browse the repository at this point in the history
  • Loading branch information
rfermann committed Apr 23, 2021
1 parent 1e03ebc commit 29b642a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports[`ResolverHandler should parse resolvers and create correct resolver file
import { } from \\"\\";
import { User } from \\"../../User/model\\";
import { AggregateUser } from \\"../inputTypes/AggregateUser\\";
import { AggregateUser } from \\"./AggregateUser\\";
import { AggregateUser } from \\"../outputTypes/AggregateUser\\";
import { Prisma } from \\"@prisma/client\\";
@Resolver(() => User, {
Expand Down
5 changes: 4 additions & 1 deletion src/Handlers/ResolverHandler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export class ResolverHandler extends BaseHandler {

if (this._getResolverName(outputType) !== name) {
this.baseFileGenerator.addOutputTypeImports({
isResolver: true,
model,
sourceFile,
types: [outputType],
Expand Down Expand Up @@ -222,7 +223,9 @@ export class ResolverHandler extends BaseHandler {
} })`
)
.conditionalWriteLine(
(!this.config.includePrismaSelect && !isAggregation) || isAggregation || isBatchOperation,
(!this.config.includePrismaSelect && !isAggregation) ||
(!this.config.includePrismaSelect && isAggregation) ||
isBatchOperation,
`return this._prismaService.${this._camelCase(model)}.${operation}({ ...${
this.config.inputArgumentsName
} })`
Expand Down

0 comments on commit 29b642a

Please sign in to comment.