|
|
@ -1,6 +1,6 @@ |
|
|
|
import { Inject, Injectable } from '@nestjs/common' |
|
|
|
import { Inject, Injectable } from '@nestjs/common' |
|
|
|
import { Users } from 'src/core' |
|
|
|
import { Sessions, Users } from 'src/core' |
|
|
|
import { USERS_AUTH_SERVICE } from 'src/core/consts' |
|
|
|
import { SESSIONS_SERVICE, USERS_AUTH_SERVICE } from 'src/core/consts' |
|
|
|
import { ConfirmLoginCodePayloadDto, LoginPayloadDto, LogoutPayloadDto } from '../dto' |
|
|
|
import { ConfirmLoginCodePayloadDto, LoginPayloadDto, LogoutPayloadDto } from '../dto' |
|
|
|
import { CheckCodePayloadDto } from '../dto/check-code.dto' |
|
|
|
import { CheckCodePayloadDto } from '../dto/check-code.dto' |
|
|
|
|
|
|
|
|
|
|
@ -8,6 +8,7 @@ import { CheckCodePayloadDto } from '../dto/check-code.dto' |
|
|
|
export class AppAuthService { |
|
|
|
export class AppAuthService { |
|
|
|
constructor( |
|
|
|
constructor( |
|
|
|
@Inject(USERS_AUTH_SERVICE) private readonly usersAuthService: Users.IUsersAuthService, |
|
|
|
@Inject(USERS_AUTH_SERVICE) private readonly usersAuthService: Users.IUsersAuthService, |
|
|
|
|
|
|
|
@Inject(SESSIONS_SERVICE) private readonly sessionsService: Sessions.ISessionsService, |
|
|
|
) {} |
|
|
|
) {} |
|
|
|
|
|
|
|
|
|
|
|
public async signIn(dto: LoginPayloadDto) { |
|
|
|
public async signIn(dto: LoginPayloadDto) { |
|
|
@ -30,4 +31,8 @@ export class AppAuthService { |
|
|
|
public async logout(dto: LogoutPayloadDto) { |
|
|
|
public async logout(dto: LogoutPayloadDto) { |
|
|
|
return await this.usersAuthService.logout(dto.refreshToken) |
|
|
|
return await this.usersAuthService.logout(dto.refreshToken) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async refreshToken(token: string) { |
|
|
|
|
|
|
|
return await this.sessionsService.refresh(token) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|