import { UseGuards } from '@nestjs/common' ; import { Query , Resolver } from '@nestjs/graphql' ; import { CurrentUser } from '../decorators/user.decorator' ; import { UserEntity } from '../entities/user.entity' ; import { GqlAuthGuard } from '../guards/gql.auth-guard' ; import { UserService } from '../services/user.service' ; @ Resolver ( 'User' ) export class UserResolver { constructor ( private readonly userService ) { } @ Query ( 'user' ) @ UseGuards ( GqlAuthGuard ) async whoAmI ( @ CurrentUser ( ) user ) { return this . userService . findOne ( user . id ) ; } }