import { Injectable , Inject } from '@nestjs/common' ; import { JwtService } from '@nestjs/jwt' ; import { PinoLogger } from 'nestjs-pino' ; import { User } from '../graphql/typings' ; @ Injectable ( ) export class AuthService { constructor ( @ Inject ( 'JwtAccessTokenService' ) private readonly accessTokenService , @ Inject ( 'JwtRefreshTokenService' ) private readonly refreshTokenService , private readonly logger ) { logger . setContext ( AuthService . name ) ; } async generateAccessToken ( user ) { return this . accessTokenService . sign ( { user : user . id } , { subject : user . id } ) ; } async generateRefreshToken ( user ) { return this . refreshTokenService . sign ( { user : user . email } , { subject : user . id } ) ; } }