1.1.0 • Published 1 year ago

forma-log v1.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Descrição

Modulo NestJS para envio de logs do sistema.

Instalação

$ npm i forma-log

Como usar

AppModule.ts

import { Module } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { LogServiceModule } from 'forma-log';

@Module({
  imports: [
    LogServiceModule.registerAsync({
      useFactory: (configService: ConfigService) => {
        return {
          awsId: configService.get('ACCOUNT_ID_AWS'),
          awsKey: configService.get('ACCESS_KEY_AWS'),
          awsRegion: configService.get('SQS_REGION'),
          awsSecret: configService.get('SECRET_KEY_AWS'),
          irSistema: 1,
        };
      },
      inject: [ConfigService],
    }),
  ],
  providers: [],
  controllers: [],
})
export class AppModule {}

AlteraPermissaoUsuario.ts

import { ILogService } from 'forma-log';

export class AlteraPermissaoUsuario
{
  async executar(
    { idUsuario, irEmpresa }: { idUsuario: number, irEmpresa: number },
  ): Promise<string> {
  
    await this.logService.logar({
      idUsuario,
      irEmpresa,
      codigoFrase: 'ANY-001',
      parametros: [1],
    });

    return "Permissao alterada com sucesso!"
  }
}

Nest is MIT licensed.

1.1.0

1 year ago

1.0.0

1 year ago