mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-19 19:39:08 +00:00
UPDATE: Added log-lib on more routes and services
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Logger, OnModuleInit, Inject } from '@nestjs/common';
|
||||
import { OnModuleInit, Inject } from '@nestjs/common';
|
||||
import { ClientGrpc } from '@nestjs/microservices';
|
||||
import { DadosferaLogger } from 'dadosfera-logs';
|
||||
|
||||
@@ -31,10 +31,16 @@ import {
|
||||
import grpcHandler from '../../utils/grpcHandler';
|
||||
|
||||
export class AuthClientService implements OnModuleInit {
|
||||
private readonly logger = new Logger(AuthClientService.name);
|
||||
logger: any;
|
||||
|
||||
private authService: AuthServiceInterface;
|
||||
constructor(@Inject('DUC_PACKAGE') private readonly grpcClient: ClientGrpc) {}
|
||||
constructor(
|
||||
@Inject(DadosferaLogger)
|
||||
dadosferaLogger: DadosferaLogger,
|
||||
@Inject('DUC_PACKAGE') private readonly grpcClient: ClientGrpc,
|
||||
) {
|
||||
this.logger = dadosferaLogger.logger;
|
||||
}
|
||||
|
||||
onModuleInit() {
|
||||
this.authService = this.grpcClient.getService<AuthServiceInterface>(
|
||||
@@ -43,7 +49,7 @@ export class AuthClientService implements OnModuleInit {
|
||||
}
|
||||
|
||||
async getPublicKeys() {
|
||||
this.logger.log('GetPublicKeys');
|
||||
this.logger.info('GetPublicKeys');
|
||||
|
||||
return grpcHandler<AuthGetPublicKeysResponse>(
|
||||
this.authService.AuthGetPublicKeys({}),
|
||||
@@ -51,7 +57,7 @@ export class AuthClientService implements OnModuleInit {
|
||||
}
|
||||
|
||||
async signIn({ username, password, totp }: AuthSignInRequest) {
|
||||
this.logger.log('SignIn');
|
||||
this.logger.info('SignIn');
|
||||
|
||||
return grpcHandler<AuthSignInResponse>(
|
||||
this.authService.AuthSignIn({ username, password, totp }),
|
||||
@@ -59,7 +65,7 @@ export class AuthClientService implements OnModuleInit {
|
||||
}
|
||||
|
||||
async refreshAccessToken({ refreshToken }: AuthRefreshAccessTokenRequest) {
|
||||
this.logger.log('RefreshAccessToken');
|
||||
this.logger.info('RefreshAccessToken');
|
||||
|
||||
return grpcHandler<AuthRefreshAccessTokenResponse>(
|
||||
this.authService.AuthRefreshAccessToken({ refreshToken }),
|
||||
@@ -71,7 +77,7 @@ export class AuthClientService implements OnModuleInit {
|
||||
oldPassword,
|
||||
newPassword,
|
||||
}: AuthChangePasswordRequest) {
|
||||
this.logger.log('ChangePassword');
|
||||
this.logger.info('ChangePassword');
|
||||
|
||||
return grpcHandler<AuthChangePasswordResponse>(
|
||||
this.authService.AuthChangePassword({
|
||||
@@ -83,7 +89,7 @@ export class AuthClientService implements OnModuleInit {
|
||||
}
|
||||
|
||||
async resetPassword({ username }: AuthResetPasswordRequest) {
|
||||
this.logger.log('resetPassword');
|
||||
this.logger.info('resetPassword');
|
||||
|
||||
return grpcHandler<AuthResetPasswordResponse>(
|
||||
this.authService.AuthResetPassword({ username }),
|
||||
@@ -94,7 +100,7 @@ export class AuthClientService implements OnModuleInit {
|
||||
username,
|
||||
code,
|
||||
}: AuthVerifyResetPasswordCodeRequest) {
|
||||
this.logger.log('verifyResetPasswordCode');
|
||||
this.logger.info('verifyResetPasswordCode');
|
||||
|
||||
return grpcHandler<AuthVerifyResetPasswordCodeResponse>(
|
||||
this.authService.AuthVerifyResetPasswordCode({ username, code }),
|
||||
@@ -106,7 +112,7 @@ export class AuthClientService implements OnModuleInit {
|
||||
code,
|
||||
newPassword,
|
||||
}: AuthConfirmResetPasswordRequest) {
|
||||
this.logger.log('confirmResetPassword');
|
||||
this.logger.info('confirmResetPassword');
|
||||
|
||||
return grpcHandler<AuthConfirmResetPasswordResponse>(
|
||||
this.authService.AuthConfirmResetPassword({
|
||||
@@ -118,7 +124,7 @@ export class AuthClientService implements OnModuleInit {
|
||||
}
|
||||
|
||||
async enableTotpMFA({ accessToken, password }: AuthEnableTotpMfaRequest) {
|
||||
this.logger.log('enableTotpMFA');
|
||||
this.logger.info('enableTotpMFA');
|
||||
|
||||
return grpcHandler<AuthEnableTotpMfaResponse>(
|
||||
this.authService.AuthEnableTotpMfa({ accessToken, password }),
|
||||
@@ -126,7 +132,7 @@ export class AuthClientService implements OnModuleInit {
|
||||
}
|
||||
|
||||
async disableTotpMFA({ accessToken, password }: AuthDisableTotpMfaRequest) {
|
||||
this.logger.log('disableTotpMFA');
|
||||
this.logger.info('disableTotpMFA');
|
||||
|
||||
return grpcHandler<AuthDisableTotpMfaResponse>(
|
||||
this.authService.AuthDisableTotpMfa({ accessToken, password }),
|
||||
@@ -134,7 +140,7 @@ export class AuthClientService implements OnModuleInit {
|
||||
}
|
||||
|
||||
async dismissTotpMFA({ accessToken }: AuthDismissTotpMfaRequest) {
|
||||
this.logger.log('dismissTotpMFA');
|
||||
this.logger.info('dismissTotpMFA');
|
||||
|
||||
return grpcHandler<AuthDismissTotpMfaResponse>(
|
||||
this.authService.AuthDismissTotpMfa({ accessToken }),
|
||||
@@ -142,7 +148,7 @@ export class AuthClientService implements OnModuleInit {
|
||||
}
|
||||
|
||||
async verifyTotp({ accessToken, totp }: AuthVerifyTotpMfaRequest) {
|
||||
this.logger.log('disableTotpMFA');
|
||||
this.logger.info('disableTotpMFA');
|
||||
|
||||
return grpcHandler<AuthVerifyTotpMfaResponse>(
|
||||
this.authService.AuthVerifyTotpMfa({ accessToken, totp }),
|
||||
|
||||
Reference in New Issue
Block a user