mirror of
https://github.com/ershisan99/flashcards-api.git
synced 2025-12-17 05:09:26 +00:00
remove console logs
This commit is contained in:
@@ -21,8 +21,6 @@ export class AuthService {
|
|||||||
const refreshToken = jwt.sign(payload, refreshSecretKey, {
|
const refreshToken = jwt.sign(payload, refreshSecretKey, {
|
||||||
expiresIn: '30d',
|
expiresIn: '30d',
|
||||||
})
|
})
|
||||||
console.log(refreshToken.length)
|
|
||||||
// Save refresh token in the database
|
|
||||||
await this.prisma.refreshToken.create({
|
await this.prisma.refreshToken.create({
|
||||||
data: {
|
data: {
|
||||||
userId: userId,
|
userId: userId,
|
||||||
|
|||||||
@@ -6,14 +6,13 @@ import { AppSettings } from '../../../settings/app-settings'
|
|||||||
import { Request } from 'express'
|
import { Request } from 'express'
|
||||||
|
|
||||||
const cookieExtractor = function (req: Request) {
|
const cookieExtractor = function (req: Request) {
|
||||||
console.log(req.cookies)
|
|
||||||
let token = null
|
let token = null
|
||||||
if (req && req.cookies) {
|
if (req && req.cookies) {
|
||||||
token = req.cookies['refreshToken']
|
token = req.cookies['refreshToken']
|
||||||
}
|
}
|
||||||
console.log(token)
|
|
||||||
return token
|
return token
|
||||||
}
|
}
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class JwtRefreshStrategy extends PassportStrategy(Strategy, 'jwt-refresh') {
|
export class JwtRefreshStrategy extends PassportStrategy(Strategy, 'jwt-refresh') {
|
||||||
|
|||||||
@@ -18,10 +18,11 @@ export class ResendVerificationEmailHandler
|
|||||||
|
|
||||||
async execute(command: ResendVerificationEmailCommand) {
|
async execute(command: ResendVerificationEmailCommand) {
|
||||||
const user = await this.usersRepository.findUserById(command.userId)
|
const user = await this.usersRepository.findUserById(command.userId)
|
||||||
console.log(user)
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
throw new NotFoundException('User not found')
|
throw new NotFoundException('User not found')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user.isEmailVerified) {
|
if (user.isEmailVerified) {
|
||||||
throw new BadRequestException('Email has already been verified')
|
throw new BadRequestException('Email has already been verified')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ export class UsersRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async createUser(newUser: CreateUserInput): Promise<User | null> {
|
async createUser(newUser: CreateUserInput): Promise<User | null> {
|
||||||
console.log(newUser)
|
|
||||||
return await this.prisma.user.create({
|
return await this.prisma.user.create({
|
||||||
data: {
|
data: {
|
||||||
email: newUser.email,
|
email: newUser.email,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Injectable } from '@nestjs/common'
|
import { Injectable, Logger } from '@nestjs/common'
|
||||||
import { UsersRepository } from '../infrastructure/users.repository'
|
import { UsersRepository } from '../infrastructure/users.repository'
|
||||||
import * as bcrypt from 'bcrypt'
|
import * as bcrypt from 'bcrypt'
|
||||||
import { MailerService } from '@nestjs-modules/mailer'
|
import { MailerService } from '@nestjs-modules/mailer'
|
||||||
@@ -7,6 +7,8 @@ import { MailerService } from '@nestjs-modules/mailer'
|
|||||||
export class UsersService {
|
export class UsersService {
|
||||||
constructor(private usersRepository: UsersRepository, private emailService: MailerService) {}
|
constructor(private usersRepository: UsersRepository, private emailService: MailerService) {}
|
||||||
|
|
||||||
|
private logger = new Logger(UsersService.name)
|
||||||
|
|
||||||
async getUsers(page: number, pageSize: number, searchNameTerm: string, searchEmailTerm: string) {
|
async getUsers(page: number, pageSize: number, searchNameTerm: string, searchEmailTerm: string) {
|
||||||
return await this.usersRepository.getUsers(page, pageSize, searchNameTerm, searchEmailTerm)
|
return await this.usersRepository.getUsers(page, pageSize, searchNameTerm, searchEmailTerm)
|
||||||
}
|
}
|
||||||
@@ -41,7 +43,7 @@ export class UsersService {
|
|||||||
subject: 'E-mail confirmation',
|
subject: 'E-mail confirmation',
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
this.logger.error(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user