Skip to content

Commit

Permalink
fix(hydra-cli): declaration:true for graphql-server + fix resolver du…
Browse files Browse the repository at this point in the history
…plicate names (#338)

* fix(hydra-cli): set tsc declaration flag to true for generated graphql-server

affects: @dzlzv/hydra-cli

* fix(hydra-cli): duplicate function name in resolver.ts

affects: @dzlzv/hydra-cli

* fix(hydra-cli): fix tests

affects: @dzlzv/hydra-cli
  • Loading branch information
metmirr authored Mar 29, 2021
1 parent b31aae3 commit e3fa092
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/hydra-cli/src/templates/entities/resolver.ts.mst
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class {{className}}Resolver {
}

@Query(() => {{className}}, { nullable: true })
async {{camelName}}(
async {{camelName}}ByUniqueInput(
@Arg('where') where: {{className}}WhereUniqueInput,
@Fields() fields: string[]
): Promise<{{className}} | null> {
Expand Down Expand Up @@ -149,5 +149,6 @@ export class {{className}}Resolver {
}
return null;
}

{{/fieldResolvers}}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"strict": true,
"strictNullChecks": true,
"types": ["isomorphic-fetch", "node"],
"esModuleInterop": true
"esModuleInterop": true,
"declaration": true
},
"include": ["src/**/*", "db/**/*"],
"exclude": ["node_modules/**/*", "generated/**/*", "tools/**/*"]
Expand Down
5 changes: 4 additions & 1 deletion packages/hydra-cli/test/helpers/ModelRenderer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,10 @@ describe('ModelRenderer', () => {

expect(rendered).to.include(`Query(() => Channel, { nullable: true })`)
expect(rendered).to.include(
`async channel(@Arg('where') where: ChannelWhereUniqueInput, @Fields() fields: string[]): Promise<Channel | null>`
`async channelByUniqueInput(
@Arg('where') where: ChannelWhereUniqueInput,
@Fields() fields: string[]
): Promise<Channel | null>`
)
expect(rendered).to.include(
`this.service.find(where, undefined, 1, 0, fields)`
Expand Down

0 comments on commit e3fa092

Please sign in to comment.