1.2.4 • Published 2 years ago

backend-common-package v1.2.4

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Backend common package

CommonModule

Append the CommonModule.forRoot() into your current module import array. This will allow you to use Guards, Services, etc.

import { CommonModule } from 'backend-common-package';
CommonModule.forRoot({
  cacheConfig: { store: example_redisStore },
  kafkaConfig:  {
    transport: Transport.KAFKA,
    options: {
      client: {
          clientId: process.env.CLIENT_ID,
            brokers: [process.env.BROKERS],
      },
      consumer: {
          groupId: process.env.GROUP_ID,
      },
    },,
}),

Guards

Request headers:\ key: otp-target-type, value: 'email' or 'phone'\ key: otp-target, value: 'a@a.com' or '+51987654321' for example\ key: otp-new-uuid-for-this-operation, value: 'some random uuid'

import {
  SendOperationOtpGuard,
  ValidatedOperationOtpGuard,
} from 'backend-common-package';
@UseGuards(SendOperationOtpGuard, ValidatedOperationOtpGuard)

Event

SendOperationOtpGuard emits a kafka event that should be listened by your email or sms sender:

Topic:
  'SEND_OPERATION_OTP'

Payload:
  {
    targetType: 'email' | 'phone',
    target: string,
    otp: string,
  }

Service

import { GuardsService } from 'backend-common-package';
constructor(
  private readonly guardsService: GuardsService,
) {}
await this.guardsService.validateOperationOtp(input: {
  operationUUID: string;
  otp: string;
}),
1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.14

2 years ago

1.1.13

2 years ago

1.1.12

2 years ago

1.1.11

2 years ago

1.1.10

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.1.17

2 years ago

0.1.16

2 years ago

0.1.15

2 years ago

0.1.14

2 years ago

0.1.13

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago