nestjs_auth...
This commit is contained in:
parent
3a3b2bd1b0
commit
3ee53b2992
@ -41,7 +41,7 @@ export class AuthService {
|
||||
|
||||
async register(data: UserDTO): Promise<any | null> {
|
||||
const tokens = await this.getTokens(data)
|
||||
data.refresh_key = tokens['refresh-token']
|
||||
data.refresh_token = tokens['refresh_token']
|
||||
const encryptedPassword = await this.getEcryptedPassword(data.password)
|
||||
data.password = encryptedPassword
|
||||
const user = await this.userService.add(data)
|
||||
@ -53,7 +53,7 @@ export class AuthService {
|
||||
const tokens = await this.getTokens(user)
|
||||
await this.userService.update({
|
||||
where: { id: user.id },
|
||||
data: { refresh_token: tokens['refresh-token'] }
|
||||
data: { refresh_token: tokens['refresh_token'] }
|
||||
})
|
||||
return tokens
|
||||
}
|
||||
@ -76,6 +76,6 @@ export class AuthService {
|
||||
}
|
||||
)
|
||||
])
|
||||
return { 'access-token': accessToken, 'refresh-token': refreshToken }
|
||||
return { access_token: accessToken, refresh_token: refreshToken }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import { ROLE, User } from '@prisma/client'
|
||||
import { ROLE } from '@prisma/client'
|
||||
|
||||
export class UserDTO {
|
||||
email: string
|
||||
password: string
|
||||
name: string
|
||||
role?: ROLE | 'USER'
|
||||
refresh_key?: string
|
||||
refresh_token?: string
|
||||
is_done?: boolean | false
|
||||
updatedAt?: Date | null
|
||||
createdAt?: Date
|
||||
|
||||
Loading…
Reference in New Issue
Block a user