add auth docs, add eslint import/order

This commit is contained in:
andres
2023-07-16 19:44:58 +02:00
parent 0f3e89900a
commit aa7ece41a9
74 changed files with 1152 additions and 164 deletions

View File

@@ -1,7 +1,8 @@
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs'
import { AuthRepository } from '../infrastructure/auth.repository'
import * as jwt from 'jsonwebtoken'
import { addDays } from 'date-fns'
import * as jwt from 'jsonwebtoken'
import { AuthRepository } from '../infrastructure/auth.repository'
export class RefreshTokenCommand {
constructor(public readonly userId: string) {}
@@ -26,7 +27,9 @@ export class RefreshTokenHandler implements ICommandHandler<RefreshTokenCommand>
expiresIn: '30d',
})
const expiresIn = addDays(new Date(), 30)
await this.authRepository.createRefreshToken(userId, refreshToken, expiresIn)
return {
accessToken,
refreshToken,