diff --git a/apps/users-application/src/users/users.module.ts b/apps/users-application/src/users/users.module.ts index 446194d..6e48de3 100644 --- a/apps/users-application/src/users/users.module.ts +++ b/apps/users-application/src/users/users.module.ts @@ -13,10 +13,18 @@ import { ApolloServerPluginInlineTrace } from '@apollo/server/plugin/inlineTrace imports: [ GraphQLModule.forRoot({ driver: ApolloFederationDriver, - // autoSchemaFile: true, - + autoSchemaFile: { + /** + * MEMO: + * Because of this problem, so mush need specify the version + * https://github.com/nestjs/graphql/issues/2646#issuecomment-1567381944 + */ + federation: 2, + }, + playground: process.env['NODE_ENV'] !== 'production', + sortSchema: true, plugins: [ApolloServerPluginInlineTrace()], }), ], }) -export class UsersModule {} \ No newline at end of file +export class UsersModule {} diff --git a/apps/users-application/src/users/users.resolver.ts b/apps/users-application/src/users/users.resolver.ts index 04d7704..27c438d 100644 --- a/apps/users-application/src/users/users.resolver.ts +++ b/apps/users-application/src/users/users.resolver.ts @@ -7,7 +7,7 @@ import { UsersService } from './users.service'; export class UsersResolver { constructor(private usersService: UsersService) {} - @Query() + @Query(() => User, { nullable: true }) getUser(@Args({ name: 'id', type: () => ID }) id: number): User | undefined { return this.usersService.findById(id); }