update packages, use constants

This commit is contained in:
Sylvain Briat 2023-10-31 11:08:39 +01:00
parent c0c7d8fe06
commit e77642667e
18 changed files with 4148 additions and 2178 deletions

View File

@ -3,6 +3,7 @@ SERVICE_URL=0.0.0.0
SERVICE_PORT=5099 SERVICE_PORT=5099
HEALTH_SERVICE_PORT=6099 HEALTH_SERVICE_PORT=6099
# RABBIT MQ # MESSAGE BROKER
MESSAGE_BROKER_URI=amqp://v3-broker:5672 MESSAGE_BROKER_URI=amqp://v3-broker:5672
MESSAGE_BROKER_EXCHANGE=mobicoop MESSAGE_BROKER_EXCHANGE=mobicoop
MESSAGE_BROKER_EXCHANGE_DURABILITY=true

5371
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -24,48 +24,48 @@
"test:e2e": "jest --config ./test/jest-e2e.json" "test:e2e": "jest --config ./test/jest-e2e.json"
}, },
"dependencies": { "dependencies": {
"@golevelup/nestjs-rabbitmq": "^3.4.0", "@golevelup/nestjs-rabbitmq": "^4.0.0",
"@grpc/grpc-js": "^1.8.14", "@grpc/grpc-js": "^1.9.9",
"@grpc/proto-loader": "^0.7.6", "@grpc/proto-loader": "^0.7.10",
"@mobicoop/ddd-library": "^0.3.0", "@mobicoop/ddd-library": "^2.1.1",
"@mobicoop/health-module": "^2.0.0", "@mobicoop/health-module": "^2.3.1",
"@nestjs/axios": "^2.0.0", "@nestjs/axios": "^3.0.1",
"@nestjs/common": "^9.0.0", "@nestjs/common": "^10.2.7",
"@nestjs/config": "^2.2.0", "@nestjs/config": "^3.1.1",
"@nestjs/core": "^9.0.0", "@nestjs/core": "^10.2.7",
"@nestjs/microservices": "^9.2.1", "@nestjs/microservices": "^10.2.7",
"@nestjs/platform-express": "^9.0.0", "@nestjs/platform-express": "^10.2.7",
"@nestjs/terminus": "^9.2.2", "@nestjs/terminus": "^10.1.1",
"axios": "^1.3.4", "axios": "^1.6.0",
"nest-winston": "^1.8.0", "nest-winston": "^1.9.4",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2", "rimraf": "^5.0.5",
"rxjs": "^7.2.0", "rxjs": "^7.8.1",
"winston": "^3.8.2", "winston": "^3.11.0",
"winston-daily-rotate-file": "^4.7.1" "winston-daily-rotate-file": "^4.7.1"
}, },
"devDependencies": { "devDependencies": {
"@nestjs/cli": "^9.0.0", "@nestjs/cli": "^10.2.1",
"@nestjs/schematics": "^9.0.0", "@nestjs/schematics": "^10.0.3",
"@nestjs/testing": "^9.0.0", "@nestjs/testing": "^10.2.7",
"@types/express": "^4.17.13", "@types/express": "^4.17.20",
"@types/jest": "28.1.8", "@types/jest": "29.5.7",
"@types/node": "^16.0.0", "@types/node": "^20.8.10",
"@types/supertest": "^2.0.11", "@types/supertest": "^2.0.15",
"@typescript-eslint/eslint-plugin": "^5.0.0", "@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^5.0.0", "@typescript-eslint/parser": "^6.9.1",
"eslint": "^8.0.1", "eslint": "^8.52.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^4.0.0", "eslint-plugin-prettier": "^5.0.1",
"jest": "28.1.3", "jest": "29.7.0",
"prettier": "^2.3.2", "prettier": "^3.0.3",
"source-map-support": "^0.5.20", "source-map-support": "^0.5.21",
"supertest": "^6.1.3", "supertest": "^6.3.3",
"ts-jest": "28.0.8", "ts-jest": "29.1.1",
"ts-loader": "^9.2.3", "ts-loader": "^9.5.0",
"ts-node": "^10.0.0", "ts-node": "^10.9.1",
"tsconfig-paths": "4.1.0", "tsconfig-paths": "4.2.0",
"typescript": "^4.7.4" "typescript": "^5.2.2"
}, },
"jest": { "jest": {
"moduleFileExtensions": [ "moduleFileExtensions": [

215
src/app.constants.ts Normal file
View File

@ -0,0 +1,215 @@
// service
export const SERVICE_NAME = 'logger';
// health
export const GRPC_HEALTH_PACKAGE_NAME = 'health';
// messaging
export const GATEWAY_API_HEALTH_CRIT_MESSAGE_HANDLER =
'loggingGatewayApiHealthCrit';
export const GATEWAY_API_HEALTH_CRIT_ROUTING_KEY =
'logging.gateway-api.health.crit';
export const GATEWAY_API_HEALTH_CRIT_QUEUE = 'logging-gateway-api-health-crit';
export const ADMIN_API_HEALTH_CRIT_MESSAGE_HANDLER =
'loggingAdminApiHealthCrit';
export const ADMIN_API_HEALTH_CRIT_ROUTING_KEY =
'logging.admin-api.health.crit';
export const ADMIN_API_HEALTH_CRIT_QUEUE = 'logging-admin-api-health-crit';
export const AD_CREATED_INFO_MESSAGE_HANDLER = 'loggingAdCreatedInfo';
export const AD_CREATED_INFO_ROUTING_KEY = 'logging.ad.created.info';
export const AD_CREATED_INFO_QUEUE = 'logging-ad-created-info';
export const AD_CREATED_WARNING_MESSAGE_HANDLER = 'loggingAdCreatedWarning';
export const AD_CREATED_WARNING_ROUTING_KEY = 'logging.ad.created.warning';
export const AD_CREATED_WARNING_QUEUE = 'logging-ad-created-warning';
export const AD_CREATED_CRIT_MESSAGE_HANDLER = 'loggingAdCreatedCrit';
export const AD_CREATED_CRIT_ROUTING_KEY = 'logging.ad.created.crit';
export const AD_CREATED_CRIT_QUEUE = 'logging-ad-created-crit';
export const AD_DELETED_INFO_MESSAGE_HANDLER = 'loggingAdDeletedInfo';
export const AD_DELETED_INFO_ROUTING_KEY = 'logging.ad.deleted.info';
export const AD_DELETED_INFO_QUEUE = 'logging-ad-deleted-info';
export const AD_DELETED_CRIT_MESSAGE_HANDLER = 'loggingAdDeletedCrit';
export const AD_DELETED_CRIT_ROUTING_KEY = 'logging.ad.deleted.crit';
export const AD_DELETED_CRIT_QUEUE = 'logging-ad-deleted-crit';
export const AD_READ_WARNING_MESSAGE_HANDLER = 'loggingAdReadWarning';
export const AD_READ_WARNING_ROUTING_KEY = 'logging.ad.read.warning';
export const AD_READ_WARNING_QUEUE = 'logging-ad-read-warning';
export const AD_UPDATED_INFO_MESSAGE_HANDLER = 'loggingAdUpdatedInfo';
export const AD_UPDATED_INFO_ROUTING_KEY = 'logging.ad.updated.info';
export const AD_UPDATED_INFO_QUEUE = 'logging-ad-updated-info';
export const AD_UPDATED_CRIT_MESSAGE_HANDLER = 'loggingAdUpdatedCrit';
export const AD_UPDATED_CRIT_ROUTING_KEY = 'logging.ad.updated.crit';
export const AD_UPDATED_CRIT_QUEUE = 'logging-ad-updated-crit';
export const AD_HEALTH_CRIT_MESSAGE_HANDLER = 'loggingAdHealthCrit';
export const AD_HEALTH_CRIT_ROUTING_KEY = 'logging.ad.health.crit';
export const AD_HEALTH_CRIT_QUEUE = 'logging-ad-health-crit';
export const AUTH_CREATED_CRIT_MESSAGE_HANDLER = 'loggingAuthCreatedCrit';
export const AUTH_CREATED_CRIT_ROUTING_KEY = 'logging.auth.created.crit';
export const AUTH_CREATED_CRIT_QUEUE = 'logging-auth-created-crit';
export const AUTH_DELETED_CRIT_MESSAGE_HANDLER = 'loggingAuthDeletedCrit';
export const AUTH_DELETED_CRIT_ROUTING_KEY = 'logging.auth.deleted.crit';
export const AUTH_DELETED_CRIT_QUEUE = 'logging-auth-deleted-crit';
export const AUTH_READ_WARNING_MESSAGE_HANDLER = 'loggingAuthReadWarning';
export const AUTH_READ_WARNING_ROUTING_KEY = 'logging.auth.read.warning';
export const AUTH_READ_WARNING_QUEUE = 'logging-auth-read-warning';
export const AUTH_USERNAME_CREATED_WARNING_MESSAGE_HANDLER =
'loggingAuthUsernameCreatedWarning';
export const AUTH_USERNAME_CREATED_WARNING_ROUTING_KEY =
'logging.auth.username.created.warning';
export const AUTH_USERNAME_CREATED_WARNING_QUEUE =
'logging-auth-username-created-warning';
export const AUTH_USERNAME_DELETED_WARNING_MESSAGE_HANDLER =
'loggingAuthUsernameDeletedWarning';
export const AUTH_USERNAME_DELETED_WARNING_ROUTING_KEY =
'logging.auth.username.deleted.warning';
export const AUTH_USERNAME_DELETED_WARNING_QUEUE =
'logging-auth-username-deleted-warning';
export const AUTH_USERNAME_READ_WARNING_MESSAGE_HANDLER =
'loggingAuthUsernameReadWarning';
export const AUTH_USERNAME_READ_WARNING_ROUTING_KEY =
'logging.auth.username.read.warning';
export const AUTH_USERNAME_READ_WARNING_QUEUE =
'logging-auth-username-read-warning';
export const AUTH_PASSWORD_UPDATED_WARNING_MESSAGE_HANDLER =
'loggingAuthPasswordUpdatedWarning';
export const AUTH_PASSWORD_UPDATED_WARNING_ROUTING_KEY =
'logging.auth.password.updated.warning';
export const AUTH_PASSWORD_UPDATED_WARNING_QUEUE =
'logging-auth-password-updated-warning';
export const AUTH_USERNAME_UPDATED_WARNING_MESSAGE_HANDLER =
'loggingAuthUsernameUpdatedWarning';
export const AUTH_USERNAME_UPDATED_WARNING_ROUTING_KEY =
'logging.auth.username.updated.warning';
export const AUTH_USERNAME_UPDATED_WARNING_QUEUE =
'logging-auth-username-updated-warning';
export const AUTH_HEALTH_CRIT_MESSAGE_HANDLER = 'loggingAuthHealthCrit';
export const AUTH_HEALTH_CRIT_ROUTING_KEY = 'logging.auth.health.crit';
export const AUTH_HEALTH_CRIT_QUEUE = 'logging-auth-health-crit';
export const CONFIGURATION_HEALTH_CRIT_MESSAGE_HANDLER =
'loggingConfigurationHealthCrit';
export const CONFIGURATION_HEALTH_CRIT_ROUTING_KEY =
'logging.configuration.health.crit';
export const CONFIGURATION_HEALTH_CRIT_QUEUE =
'logging-configuration-health-crit';
export const LOGGER_HEALTH_CRIT_MESSAGE_HANDLER = 'loggingLoggerHealthCrit';
export const LOGGER_HEALTH_CRIT_ROUTING_KEY = 'logging.logger.health.crit';
export const LOGGER_HEALTH_CRIT_QUEUE = 'logging-logger-health-crit';
export const MATCHER_AD_CRIT_MESSAGE_HANDLER = 'loggingMatcherAdCrit';
export const MATCHER_AD_CRIT_ROUTING_KEY = 'logging.matcher.ad.crit';
export const MATCHER_AD_CRIT_QUEUE = 'logging-matcher-ad-crit';
export const MATCHER_MATCH_CRIT_MESSAGE_HANDLER = 'loggingMatcherMatchCrit';
export const MATCHER_MATCH_CRIT_ROUTING_KEY = 'logging.matcher.match.crit';
export const MATCHER_MATCH_CRIT_QUEUE = 'logging-matcher-match-crit';
export const TERRITORY_CREATED_INFO_MESSAGE_HANDLER =
'loggingTerritoryCreatedInfo';
export const TERRITORY_CREATED_INFO_ROUTING_KEY =
'logging.territory.created.info';
export const TERRITORY_CREATED_INFO_QUEUE = 'logging-territory-created-info';
export const TERRITORY_CREATED_WARNING_MESSAGE_HANDLER =
'loggingTerritoryCreatedWarning';
export const TERRITORY_CREATED_WARNING_ROUTING_KEY =
'logging.territory.created.warning';
export const TERRITORY_CREATED_WARNING_QUEUE =
'logging-territory-created-warning';
export const TERRITORY_CREATED_CRIT_MESSAGE_HANDLER =
'loggingTerritoryCreatedCrit';
export const TERRITORY_CREATED_CRIT_ROUTING_KEY =
'logging.territory.created.crit';
export const TERRITORY_CREATED_CRIT_QUEUE = 'logging-territory-created-crit';
export const TERRITORY_DELETED_INFO_MESSAGE_HANDLER =
'loggingTerritoryDeletedInfo';
export const TERRITORY_DELETED_INFO_ROUTING_KEY =
'logging.territory.deleted.info';
export const TERRITORY_DELETED_INFO_QUEUE = 'logging-territory-deleted-info';
export const TERRITORY_DELETED_CRIT_MESSAGE_HANDLER =
'loggingTerritoryDeletedCrit';
export const TERRITORY_DELETED_CRIT_ROUTING_KEY =
'logging.territory.deleted.crit';
export const TERRITORY_DELETED_CRIT_QUEUE = 'logging-territory-deleted-crit';
export const TERRITORY_READ_WARNING_MESSAGE_HANDLER =
'loggingTerritoryReadWarning';
export const TERRITORY_READ_WARNING_ROUTING_KEY =
'logging.territory.read.warning';
export const TERRITORY_READ_WARNING_QUEUE = 'logging-territory-read-warning';
export const TERRITORY_UPDATED_INFO_MESSAGE_HANDLER =
'loggingTerritoryUpdatedInfo';
export const TERRITORY_UPDATED_INFO_ROUTING_KEY =
'logging.territory.updated.info';
export const TERRITORY_UPDATED_INFO_QUEUE = 'logging-territory-updated-info';
export const TERRITORY_UPDATED_CRIT_MESSAGE_HANDLER =
'loggingTerritoryUpdatedCrit';
export const TERRITORY_UPDATED_CRIT_ROUTING_KEY =
'logging.territory.updated.crit';
export const TERRITORY_UPDATED_CRIT_QUEUE = 'logging-territory-updated-crit';
export const TERRITORY_HEALTH_CRIT_MESSAGE_HANDLER =
'loggingTerritoryHealthCrit';
export const TERRITORY_HEALTH_CRIT_ROUTING_KEY =
'logging.territory.health.crit';
export const TERRITORY_HEALTH_CRIT_QUEUE = 'logging-territory-health-crit';
export const USER_CREATED_INFO_MESSAGE_HANDLER = 'loggingUserCreatedInfo';
export const USER_CREATED_INFO_ROUTING_KEY = 'logging.user.created.info';
export const USER_CREATED_INFO_QUEUE = 'logging-user-created-info';
export const USER_CREATED_WARNING_MESSAGE_HANDLER = 'loggingUserCreatedWarning';
export const USER_CREATED_WARNING_ROUTING_KEY = 'logging.user.created.warning';
export const USER_CREATED_WARNING_QUEUE = 'logging-user-created-warning';
export const USER_CREATED_CRIT_MESSAGE_HANDLER = 'loggingUserCreatedCrit';
export const USER_CREATED_CRIT_ROUTING_KEY = 'logging.user.created.crit';
export const USER_CREATED_CRIT_QUEUE = 'logging-user-created-crit';
export const USER_DELETED_INFO_MESSAGE_HANDLER = 'loggingUserDeletedInfo';
export const USER_DELETED_INFO_ROUTING_KEY = 'logging.user.deleted.info';
export const USER_DELETED_INFO_QUEUE = 'logging-user-deleted-info';
export const USER_DELETED_CRIT_MESSAGE_HANDLER = 'loggingUserDeletedCrit';
export const USER_DELETED_CRIT_ROUTING_KEY = 'logging.user.deleted.crit';
export const USER_DELETED_CRIT_QUEUE = 'logging-user-deleted-crit';
export const USER_READ_WARNING_MESSAGE_HANDLER = 'loggingUserReadWarning';
export const USER_READ_WARNING_ROUTING_KEY = 'logging.user.read.warning';
export const USER_READ_WARNING_QUEUE = 'logging-user-read-warning';
export const USER_UPDATED_INFO_MESSAGE_HANDLER = 'loggingUserUpdatedInfo';
export const USER_UPDATED_INFO_ROUTING_KEY = 'logging.user.updated.info';
export const USER_UPDATED_INFO_QUEUE = 'logging-user-updated-info';
export const USER_UPDATED_CRIT_MESSAGE_HANDLER = 'loggingUserUpdatedCrit';
export const USER_UPDATED_CRIT_ROUTING_KEY = 'logging.user.updated.crit';
export const USER_UPDATED_CRIT_QUEUE = 'logging-user-updated-crit';
export const USER_HEALTH_CRIT_MESSAGE_HANDLER = 'loggingUserHealthCrit';
export const USER_HEALTH_CRIT_ROUTING_KEY = 'logging.user.health.crit';
export const USER_HEALTH_CRIT_QUEUE = 'logging-user-health-crit';

View File

@ -6,6 +6,7 @@ import { MessagerModule } from '@modules/messager/messager.module';
import { HttpModule } from '@nestjs/axios'; import { HttpModule } from '@nestjs/axios';
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config'; import { ConfigModule } from '@nestjs/config';
import { LOGGER_HEALTH_CRIT_ROUTING_KEY, SERVICE_NAME } from './app.constants';
@Module({ @Module({
imports: [ imports: [
@ -17,8 +18,8 @@ import { ConfigModule } from '@nestjs/config';
useFactory: async ( useFactory: async (
messagePublisher: MessagePublisherPort, messagePublisher: MessagePublisherPort,
): Promise<HealthModuleOptions> => ({ ): Promise<HealthModuleOptions> => ({
serviceName: 'logger', serviceName: SERVICE_NAME,
criticalLoggingKey: 'logging.logger.health.crit', criticalLoggingKey: LOGGER_HEALTH_CRIT_ROUTING_KEY,
checkUrls: [ checkUrls: [
{ {
name: 'google', name: 'google',

View File

@ -2,6 +2,7 @@ import { NestFactory } from '@nestjs/core';
import { MicroserviceOptions, Transport } from '@nestjs/microservices'; import { MicroserviceOptions, Transport } from '@nestjs/microservices';
import { join } from 'path'; import { join } from 'path';
import { AppModule } from './app.module'; import { AppModule } from './app.module';
import { GRPC_HEALTH_PACKAGE_NAME } from './app.constants';
async function bootstrap() { async function bootstrap() {
const app = await NestFactory.create(AppModule); const app = await NestFactory.create(AppModule);
@ -11,14 +12,14 @@ async function bootstrap() {
app.connectMicroservice<MicroserviceOptions>({ app.connectMicroservice<MicroserviceOptions>({
transport: Transport.GRPC, transport: Transport.GRPC,
options: { options: {
package: ['health'], package: [GRPC_HEALTH_PACKAGE_NAME],
protoPath: [join(__dirname, 'health.proto')], protoPath: [join(__dirname, 'health.proto')],
url: `${process.env.SERVICE_URL}:${process.env.SERVICE_PORT}`, url: `${process.env.SERVICE_URL}:${process.env.SERVICE_PORT}`,
loader: { keepCase: true }, loader: { keepCase: true, enums: String },
}, },
}); });
await app.startAllMicroservices(); await app.startAllMicroservices();
await app.listen(process.env.HEALTH_SERVICE_PORT); await app.listen(process.env.HEALTH_SERVICE_PORT as unknown as number);
} }
bootstrap(); bootstrap();

View File

@ -1,6 +1,6 @@
import * as winston from 'winston'; import * as winston from 'winston';
export default function filter(level) { export default function filter(level: any) {
return winston.format((info) => { return winston.format((info) => {
if (typeof level === 'string') { if (typeof level === 'string') {
if (info.level === level) return info; if (info.level === level) return info;

View File

@ -4,6 +4,17 @@ import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
import { Logger } from 'winston'; import { Logger } from 'winston';
import { level } from '../level.enum'; import { level } from '../level.enum';
import loggerOptions from '../logger.options'; import loggerOptions from '../logger.options';
import {
AD_CREATED_CRIT_MESSAGE_HANDLER,
AD_CREATED_INFO_MESSAGE_HANDLER,
AD_CREATED_WARNING_MESSAGE_HANDLER,
AD_DELETED_CRIT_MESSAGE_HANDLER,
AD_DELETED_INFO_MESSAGE_HANDLER,
AD_HEALTH_CRIT_MESSAGE_HANDLER,
AD_READ_WARNING_MESSAGE_HANDLER,
AD_UPDATED_CRIT_MESSAGE_HANDLER,
AD_UPDATED_INFO_MESSAGE_HANDLER,
} from '@src/app.constants';
export class AdMessageHandler { export class AdMessageHandler {
constructor( constructor(
@ -11,7 +22,7 @@ export class AdMessageHandler {
) {} ) {}
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingAdCreatedInfo', name: AD_CREATED_INFO_MESSAGE_HANDLER,
}) })
public async adCreatedInfoHandler(message: string) { public async adCreatedInfoHandler(message: string) {
this.logger.configure(loggerOptions('ad', level.info, 'info', 'created')); this.logger.configure(loggerOptions('ad', level.info, 'info', 'created'));
@ -19,7 +30,7 @@ export class AdMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingAdCreatedWarning', name: AD_CREATED_WARNING_MESSAGE_HANDLER,
}) })
public async adCreatedWarningHandler(message: string) { public async adCreatedWarningHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -29,7 +40,7 @@ export class AdMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingAdCreatedCrit', name: AD_CREATED_CRIT_MESSAGE_HANDLER,
}) })
public async adCreatedCriticalHandler(message: string) { public async adCreatedCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -39,7 +50,7 @@ export class AdMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingAdDeletedInfo', name: AD_DELETED_INFO_MESSAGE_HANDLER,
}) })
public async adDeletedInfoHandler(message: string) { public async adDeletedInfoHandler(message: string) {
this.logger.configure(loggerOptions('ad', level.info, 'info', 'deleted')); this.logger.configure(loggerOptions('ad', level.info, 'info', 'deleted'));
@ -47,7 +58,7 @@ export class AdMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingAdDeletedCrit', name: AD_DELETED_CRIT_MESSAGE_HANDLER,
}) })
public async adDeletedCriticalHandler(message: string) { public async adDeletedCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -57,7 +68,7 @@ export class AdMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingAdReadWarning', name: AD_READ_WARNING_MESSAGE_HANDLER,
}) })
public async adReadWarningHandler(message: string) { public async adReadWarningHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -67,7 +78,7 @@ export class AdMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingAdUpdatedInfo', name: AD_UPDATED_INFO_MESSAGE_HANDLER,
}) })
public async adUpdatedInfoHandler(message: string) { public async adUpdatedInfoHandler(message: string) {
this.logger.configure(loggerOptions('ad', level.info, 'info', 'updated')); this.logger.configure(loggerOptions('ad', level.info, 'info', 'updated'));
@ -75,7 +86,7 @@ export class AdMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingAdUpdatedCrit', name: AD_UPDATED_CRIT_MESSAGE_HANDLER,
}) })
public async adUpdatedCriticalHandler(message: string) { public async adUpdatedCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -85,7 +96,7 @@ export class AdMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingAdHealthCrit', name: AD_HEALTH_CRIT_MESSAGE_HANDLER,
}) })
public async adHealthCriticalHandler(message: string) { public async adHealthCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(

View File

@ -4,6 +4,7 @@ import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
import { Logger } from 'winston'; import { Logger } from 'winston';
import loggerOptions from '../logger.options'; import loggerOptions from '../logger.options';
import { level } from '../level.enum'; import { level } from '../level.enum';
import { ADMIN_API_HEALTH_CRIT_MESSAGE_HANDLER } from '@src/app.constants';
export class AdminApiMessageHandler { export class AdminApiMessageHandler {
constructor( constructor(
@ -11,7 +12,7 @@ export class AdminApiMessageHandler {
) {} ) {}
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingAdminApiHealthCrit', name: ADMIN_API_HEALTH_CRIT_MESSAGE_HANDLER,
}) })
public async adminApiHealthCriticalHandler(message: string) { public async adminApiHealthCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(

View File

@ -4,6 +4,17 @@ import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
import { Logger } from 'winston'; import { Logger } from 'winston';
import loggerOptions from '../logger.options'; import loggerOptions from '../logger.options';
import { level } from '../level.enum'; import { level } from '../level.enum';
import {
AUTH_CREATED_CRIT_MESSAGE_HANDLER,
AUTH_DELETED_CRIT_MESSAGE_HANDLER,
AUTH_HEALTH_CRIT_MESSAGE_HANDLER,
AUTH_PASSWORD_UPDATED_WARNING_MESSAGE_HANDLER,
AUTH_READ_WARNING_MESSAGE_HANDLER,
AUTH_USERNAME_CREATED_WARNING_MESSAGE_HANDLER,
AUTH_USERNAME_DELETED_WARNING_MESSAGE_HANDLER,
AUTH_USERNAME_READ_WARNING_MESSAGE_HANDLER,
AUTH_USERNAME_UPDATED_WARNING_MESSAGE_HANDLER,
} from '@src/app.constants';
export class AuthMessageHandler { export class AuthMessageHandler {
constructor( constructor(
@ -11,7 +22,7 @@ export class AuthMessageHandler {
) {} ) {}
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingAuthCreatedCrit', name: AUTH_CREATED_CRIT_MESSAGE_HANDLER,
}) })
public async authCreatedCriticalHandler(message: string) { public async authCreatedCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -21,7 +32,7 @@ export class AuthMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingAuthDeletedCrit', name: AUTH_DELETED_CRIT_MESSAGE_HANDLER,
}) })
public async authDeletedCriticalHandler(message: string) { public async authDeletedCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -31,7 +42,7 @@ export class AuthMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingAuthReadWarning', name: AUTH_READ_WARNING_MESSAGE_HANDLER,
}) })
public async authReadWarningHandler(message: string) { public async authReadWarningHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -41,7 +52,7 @@ export class AuthMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingAuthUsernameCreatedWarning', name: AUTH_USERNAME_CREATED_WARNING_MESSAGE_HANDLER,
}) })
public async authUsernameCreatedWarningHandler(message: string) { public async authUsernameCreatedWarningHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -51,7 +62,7 @@ export class AuthMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingAuthUsernameDeletedWarning', name: AUTH_USERNAME_DELETED_WARNING_MESSAGE_HANDLER,
}) })
public async authUsernameDeletedWarningHandler(message: string) { public async authUsernameDeletedWarningHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -61,7 +72,7 @@ export class AuthMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingAuthUsernameReadWarning', name: AUTH_USERNAME_READ_WARNING_MESSAGE_HANDLER,
}) })
public async authUsernameReadWarningHandler(message: string) { public async authUsernameReadWarningHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -71,7 +82,7 @@ export class AuthMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingAuthPasswordUpdatedWarning', name: AUTH_PASSWORD_UPDATED_WARNING_MESSAGE_HANDLER,
}) })
public async authPasswordUpdatedWarningHandler(message: string) { public async authPasswordUpdatedWarningHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -81,7 +92,7 @@ export class AuthMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingAuthUsernameUpdatedWarning', name: AUTH_USERNAME_UPDATED_WARNING_MESSAGE_HANDLER,
}) })
public async authUsernameUpdatedWarningHandler(message: string) { public async authUsernameUpdatedWarningHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -91,7 +102,7 @@ export class AuthMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingAuthHealthCrit', name: AUTH_HEALTH_CRIT_MESSAGE_HANDLER,
}) })
public async authHealthCriticalHandler(message: string) { public async authHealthCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(

View File

@ -4,6 +4,7 @@ import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
import { Logger } from 'winston'; import { Logger } from 'winston';
import loggerOptions from '../logger.options'; import loggerOptions from '../logger.options';
import { level } from '../level.enum'; import { level } from '../level.enum';
import { CONFIGURATION_HEALTH_CRIT_MESSAGE_HANDLER } from '@src/app.constants';
export class ConfigurationMessageHandler { export class ConfigurationMessageHandler {
constructor( constructor(
@ -11,87 +12,7 @@ export class ConfigurationMessageHandler {
) {} ) {}
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingConfigurationCreatedInfo', name: CONFIGURATION_HEALTH_CRIT_MESSAGE_HANDLER,
})
public async configurationCreatedInfoHandler(message: string) {
this.logger.configure(
loggerOptions('configuration', level.info, 'info', 'created'),
);
this.logger.info(JSON.parse(message));
}
@RabbitSubscribe({
name: 'loggingConfigurationCreatedWarning',
})
public async configurationCreatedWarningHandler(message: string) {
this.logger.configure(
loggerOptions('configuration', level.warning, 'warning', 'created'),
);
this.logger.warning(JSON.parse(message));
}
@RabbitSubscribe({
name: 'loggingConfigurationCreatedCrit',
})
public async configurationCreatedCriticalHandler(message: string) {
this.logger.configure(
loggerOptions('configuration', level.crit, 'critical', 'created'),
);
this.logger.crit(JSON.parse(message));
}
@RabbitSubscribe({
name: 'loggingConfigurationDeletedInfo',
})
public async configurationDeletedInfoHandler(message: string) {
this.logger.configure(
loggerOptions('configuration', level.info, 'info', 'deleted'),
);
this.logger.info(JSON.parse(message));
}
@RabbitSubscribe({
name: 'loggingConfigurationDeletedCrit',
})
public async configurationDeletedCriticalHandler(message: string) {
this.logger.configure(
loggerOptions('configuration', level.crit, 'critical', 'deleted'),
);
this.logger.crit(JSON.parse(message));
}
@RabbitSubscribe({
name: 'loggingConfigurationReadWarning',
})
public async configurationReadWarningHandler(message: string) {
this.logger.configure(
loggerOptions('configuration', level.warning, 'warning', 'read'),
);
this.logger.warning(JSON.parse(message));
}
@RabbitSubscribe({
name: 'loggingConfigurationUpdatedInfo',
})
public async configurationUpdatedInfoHandler(message: string) {
this.logger.configure(
loggerOptions('configuration', level.info, 'info', 'updated'),
);
this.logger.info(JSON.parse(message));
}
@RabbitSubscribe({
name: 'loggingConfigurationUpdatedCrit',
})
public async configurationUpdatedCriticalHandler(message: string) {
this.logger.configure(
loggerOptions('configuration', level.crit, 'critical', 'updated'),
);
this.logger.crit(JSON.parse(message));
}
@RabbitSubscribe({
name: 'loggingConfigurationHealthCrit',
}) })
public async configurationHealthCriticalHandler(message: string) { public async configurationHealthCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(

View File

@ -4,6 +4,7 @@ import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
import { Logger } from 'winston'; import { Logger } from 'winston';
import loggerOptions from '../logger.options'; import loggerOptions from '../logger.options';
import { level } from '../level.enum'; import { level } from '../level.enum';
import { GATEWAY_API_HEALTH_CRIT_MESSAGE_HANDLER } from '@src/app.constants';
export class GatewayApiMessageHandler { export class GatewayApiMessageHandler {
constructor( constructor(
@ -11,7 +12,7 @@ export class GatewayApiMessageHandler {
) {} ) {}
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingGatewayApiHealthCrit', name: GATEWAY_API_HEALTH_CRIT_MESSAGE_HANDLER,
}) })
public async gatewayApiHealthCriticalHandler(message: string) { public async gatewayApiHealthCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(

View File

@ -4,6 +4,7 @@ import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
import { Logger } from 'winston'; import { Logger } from 'winston';
import loggerOptions from '../logger.options'; import loggerOptions from '../logger.options';
import { level } from '../level.enum'; import { level } from '../level.enum';
import { LOGGER_HEALTH_CRIT_MESSAGE_HANDLER } from '@src/app.constants';
export class LoggerMessageHandler { export class LoggerMessageHandler {
constructor( constructor(
@ -11,7 +12,7 @@ export class LoggerMessageHandler {
) {} ) {}
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingLoggerHealthCrit', name: LOGGER_HEALTH_CRIT_MESSAGE_HANDLER,
}) })
public async loggerHealthCriticalHandler(message: string) { public async loggerHealthCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(

View File

@ -4,6 +4,10 @@ import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
import { Logger } from 'winston'; import { Logger } from 'winston';
import { level } from '../level.enum'; import { level } from '../level.enum';
import loggerOptions from '../logger.options'; import loggerOptions from '../logger.options';
import {
MATCHER_AD_CRIT_MESSAGE_HANDLER,
MATCHER_MATCH_CRIT_MESSAGE_HANDLER,
} from '@src/app.constants';
export class MatcherMessageHandler { export class MatcherMessageHandler {
constructor( constructor(
@ -11,7 +15,7 @@ export class MatcherMessageHandler {
) {} ) {}
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingMatcherAdCrit', name: MATCHER_AD_CRIT_MESSAGE_HANDLER,
}) })
public async matcherAdCriticalHandler(message: string) { public async matcherAdCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -21,7 +25,7 @@ export class MatcherMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingMatcherMatchCrit', name: MATCHER_MATCH_CRIT_MESSAGE_HANDLER,
}) })
public async matcherMatchCriticalHandler(message: string) { public async matcherMatchCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(

View File

@ -4,6 +4,17 @@ import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
import { Logger } from 'winston'; import { Logger } from 'winston';
import loggerOptions from '../logger.options'; import loggerOptions from '../logger.options';
import { level } from '../level.enum'; import { level } from '../level.enum';
import {
TERRITORY_CREATED_CRIT_MESSAGE_HANDLER,
TERRITORY_CREATED_INFO_MESSAGE_HANDLER,
TERRITORY_CREATED_WARNING_MESSAGE_HANDLER,
TERRITORY_DELETED_CRIT_MESSAGE_HANDLER,
TERRITORY_DELETED_INFO_MESSAGE_HANDLER,
TERRITORY_HEALTH_CRIT_MESSAGE_HANDLER,
TERRITORY_READ_WARNING_MESSAGE_HANDLER,
TERRITORY_UPDATED_CRIT_MESSAGE_HANDLER,
TERRITORY_UPDATED_INFO_MESSAGE_HANDLER,
} from '@src/app.constants';
export class TerritoryMessageHandler { export class TerritoryMessageHandler {
constructor( constructor(
@ -11,7 +22,7 @@ export class TerritoryMessageHandler {
) {} ) {}
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingTerritoryCreatedInfo', name: TERRITORY_CREATED_INFO_MESSAGE_HANDLER,
}) })
public async territoryCreatedInfoHandler(message: string) { public async territoryCreatedInfoHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -21,7 +32,7 @@ export class TerritoryMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingTerritoryCreatedWarning', name: TERRITORY_CREATED_WARNING_MESSAGE_HANDLER,
}) })
public async territoryCreatedWarningHandler(message: string) { public async territoryCreatedWarningHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -31,7 +42,7 @@ export class TerritoryMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingTerritoryCreatedCrit', name: TERRITORY_CREATED_CRIT_MESSAGE_HANDLER,
}) })
public async territoryCreatedCriticalHandler(message: string) { public async territoryCreatedCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -41,7 +52,7 @@ export class TerritoryMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingTerritoryDeletedInfo', name: TERRITORY_DELETED_INFO_MESSAGE_HANDLER,
}) })
public async territoryDeletedInfoHandler(message: string) { public async territoryDeletedInfoHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -51,7 +62,7 @@ export class TerritoryMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingTerritoryDeletedCrit', name: TERRITORY_DELETED_CRIT_MESSAGE_HANDLER,
}) })
public async territoryDeletedCriticalHandler(message: string) { public async territoryDeletedCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -61,7 +72,7 @@ export class TerritoryMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingTerritoryReadWarning', name: TERRITORY_READ_WARNING_MESSAGE_HANDLER,
}) })
public async territoryReadWarningHandler(message: string) { public async territoryReadWarningHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -71,7 +82,7 @@ export class TerritoryMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingTerritoryUpdatedInfo', name: TERRITORY_UPDATED_INFO_MESSAGE_HANDLER,
}) })
public async territoryUpdatedInfoHandler(message: string) { public async territoryUpdatedInfoHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -81,7 +92,7 @@ export class TerritoryMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingTerritoryUpdatedCrit', name: TERRITORY_UPDATED_CRIT_MESSAGE_HANDLER,
}) })
public async territoryUpdatedCriticalHandler(message: string) { public async territoryUpdatedCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -91,7 +102,7 @@ export class TerritoryMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingTerritoryHealthCrit', name: TERRITORY_HEALTH_CRIT_MESSAGE_HANDLER,
}) })
public async territoryHealthCriticalHandler(message: string) { public async territoryHealthCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(

View File

@ -4,6 +4,17 @@ import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
import { Logger } from 'winston'; import { Logger } from 'winston';
import loggerOptions from '../logger.options'; import loggerOptions from '../logger.options';
import { level } from '../level.enum'; import { level } from '../level.enum';
import {
USER_CREATED_CRIT_MESSAGE_HANDLER,
USER_CREATED_INFO_MESSAGE_HANDLER,
USER_CREATED_WARNING_MESSAGE_HANDLER,
USER_DELETED_CRIT_MESSAGE_HANDLER,
USER_DELETED_INFO_MESSAGE_HANDLER,
USER_HEALTH_CRIT_MESSAGE_HANDLER,
USER_READ_WARNING_MESSAGE_HANDLER,
USER_UPDATED_CRIT_MESSAGE_HANDLER,
USER_UPDATED_INFO_MESSAGE_HANDLER,
} from '@src/app.constants';
export class UserMessageHandler { export class UserMessageHandler {
constructor( constructor(
@ -11,7 +22,7 @@ export class UserMessageHandler {
) {} ) {}
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingUserCreatedInfo', name: USER_CREATED_INFO_MESSAGE_HANDLER,
}) })
public async userCreatedInfoHandler(message: string) { public async userCreatedInfoHandler(message: string) {
this.logger.configure(loggerOptions('user', level.info, 'info', 'created')); this.logger.configure(loggerOptions('user', level.info, 'info', 'created'));
@ -19,7 +30,7 @@ export class UserMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingUserCreatedWarning', name: USER_CREATED_WARNING_MESSAGE_HANDLER,
}) })
public async userCreatedWarningHandler(message: string) { public async userCreatedWarningHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -29,7 +40,7 @@ export class UserMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingUserCreatedCrit', name: USER_CREATED_CRIT_MESSAGE_HANDLER,
}) })
public async userCreatedCriticalHandler(message: string) { public async userCreatedCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -39,7 +50,7 @@ export class UserMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingUserDeletedInfo', name: USER_DELETED_INFO_MESSAGE_HANDLER,
}) })
public async userDeletedInfoHandler(message: string) { public async userDeletedInfoHandler(message: string) {
this.logger.configure(loggerOptions('user', level.info, 'info', 'deleted')); this.logger.configure(loggerOptions('user', level.info, 'info', 'deleted'));
@ -47,7 +58,7 @@ export class UserMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingUserDeletedCrit', name: USER_DELETED_CRIT_MESSAGE_HANDLER,
}) })
public async userDeletedCriticalHandler(message: string) { public async userDeletedCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -57,7 +68,7 @@ export class UserMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingUserReadWarning', name: USER_READ_WARNING_MESSAGE_HANDLER,
}) })
public async userReadWarningHandler(message: string) { public async userReadWarningHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -67,7 +78,7 @@ export class UserMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingUserUpdatedInfo', name: USER_UPDATED_INFO_MESSAGE_HANDLER,
}) })
public async userUpdatedInfoHandler(message: string) { public async userUpdatedInfoHandler(message: string) {
this.logger.configure(loggerOptions('user', level.info, 'info', 'updated')); this.logger.configure(loggerOptions('user', level.info, 'info', 'updated'));
@ -75,7 +86,7 @@ export class UserMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingUserUpdatedCrit', name: USER_UPDATED_CRIT_MESSAGE_HANDLER,
}) })
public async userUpdatedCriticalHandler(message: string) { public async userUpdatedCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(
@ -85,7 +96,7 @@ export class UserMessageHandler {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingUserHealthCrit', name: USER_HEALTH_CRIT_MESSAGE_HANDLER,
}) })
public async userHealthCriticalHandler(message: string) { public async userHealthCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(

View File

@ -6,6 +6,135 @@ import {
MessageBrokerPublisher, MessageBrokerPublisher,
} from '@mobicoop/message-broker-module'; } from '@mobicoop/message-broker-module';
import { ConfigModule, ConfigService } from '@nestjs/config'; import { ConfigModule, ConfigService } from '@nestjs/config';
import {
ADMIN_API_HEALTH_CRIT_MESSAGE_HANDLER,
ADMIN_API_HEALTH_CRIT_ROUTING_KEY,
ADMIN_API_HEALTH_CRIT_QUEUE,
AD_CREATED_CRIT_MESSAGE_HANDLER,
AD_CREATED_CRIT_ROUTING_KEY,
AD_CREATED_CRIT_QUEUE,
AD_CREATED_INFO_MESSAGE_HANDLER,
AD_CREATED_INFO_ROUTING_KEY,
AD_CREATED_INFO_QUEUE,
AD_CREATED_WARNING_MESSAGE_HANDLER,
AD_CREATED_WARNING_ROUTING_KEY,
AD_CREATED_WARNING_QUEUE,
AD_DELETED_CRIT_MESSAGE_HANDLER,
AD_DELETED_CRIT_ROUTING_KEY,
AD_DELETED_CRIT_QUEUE,
AD_DELETED_INFO_MESSAGE_HANDLER,
AD_DELETED_INFO_ROUTING_KEY,
AD_DELETED_INFO_QUEUE,
AD_HEALTH_CRIT_MESSAGE_HANDLER,
AD_HEALTH_CRIT_ROUTING_KEY,
AD_HEALTH_CRIT_QUEUE,
AD_READ_WARNING_MESSAGE_HANDLER,
AD_READ_WARNING_ROUTING_KEY,
AD_READ_WARNING_QUEUE,
AD_UPDATED_CRIT_MESSAGE_HANDLER,
AD_UPDATED_CRIT_ROUTING_KEY,
AD_UPDATED_CRIT_QUEUE,
AD_UPDATED_INFO_MESSAGE_HANDLER,
AD_UPDATED_INFO_ROUTING_KEY,
AD_UPDATED_INFO_QUEUE,
AUTH_CREATED_CRIT_MESSAGE_HANDLER,
AUTH_CREATED_CRIT_ROUTING_KEY,
AUTH_CREATED_CRIT_QUEUE,
AUTH_DELETED_CRIT_MESSAGE_HANDLER,
AUTH_DELETED_CRIT_ROUTING_KEY,
AUTH_DELETED_CRIT_QUEUE,
AUTH_HEALTH_CRIT_MESSAGE_HANDLER,
AUTH_HEALTH_CRIT_ROUTING_KEY,
AUTH_HEALTH_CRIT_QUEUE,
AUTH_PASSWORD_UPDATED_WARNING_MESSAGE_HANDLER,
AUTH_PASSWORD_UPDATED_WARNING_ROUTING_KEY,
AUTH_PASSWORD_UPDATED_WARNING_QUEUE,
AUTH_READ_WARNING_MESSAGE_HANDLER,
AUTH_READ_WARNING_ROUTING_KEY,
AUTH_READ_WARNING_QUEUE,
AUTH_USERNAME_CREATED_WARNING_MESSAGE_HANDLER,
AUTH_USERNAME_CREATED_WARNING_ROUTING_KEY,
AUTH_USERNAME_CREATED_WARNING_QUEUE,
AUTH_USERNAME_DELETED_WARNING_MESSAGE_HANDLER,
AUTH_USERNAME_DELETED_WARNING_ROUTING_KEY,
AUTH_USERNAME_DELETED_WARNING_QUEUE,
AUTH_USERNAME_READ_WARNING_MESSAGE_HANDLER,
AUTH_USERNAME_READ_WARNING_ROUTING_KEY,
AUTH_USERNAME_READ_WARNING_QUEUE,
AUTH_USERNAME_UPDATED_WARNING_MESSAGE_HANDLER,
AUTH_USERNAME_UPDATED_WARNING_ROUTING_KEY,
AUTH_USERNAME_UPDATED_WARNING_QUEUE,
CONFIGURATION_HEALTH_CRIT_MESSAGE_HANDLER,
CONFIGURATION_HEALTH_CRIT_ROUTING_KEY,
CONFIGURATION_HEALTH_CRIT_QUEUE,
GATEWAY_API_HEALTH_CRIT_MESSAGE_HANDLER,
GATEWAY_API_HEALTH_CRIT_ROUTING_KEY,
GATEWAY_API_HEALTH_CRIT_QUEUE,
LOGGER_HEALTH_CRIT_MESSAGE_HANDLER,
LOGGER_HEALTH_CRIT_ROUTING_KEY,
LOGGER_HEALTH_CRIT_QUEUE,
MATCHER_AD_CRIT_MESSAGE_HANDLER,
MATCHER_AD_CRIT_ROUTING_KEY,
MATCHER_AD_CRIT_QUEUE,
MATCHER_MATCH_CRIT_MESSAGE_HANDLER,
MATCHER_MATCH_CRIT_ROUTING_KEY,
MATCHER_MATCH_CRIT_QUEUE,
SERVICE_NAME,
TERRITORY_CREATED_CRIT_MESSAGE_HANDLER,
TERRITORY_CREATED_CRIT_ROUTING_KEY,
TERRITORY_CREATED_CRIT_QUEUE,
TERRITORY_CREATED_INFO_MESSAGE_HANDLER,
TERRITORY_CREATED_INFO_ROUTING_KEY,
TERRITORY_CREATED_INFO_QUEUE,
TERRITORY_CREATED_WARNING_MESSAGE_HANDLER,
TERRITORY_CREATED_WARNING_ROUTING_KEY,
TERRITORY_CREATED_WARNING_QUEUE,
TERRITORY_DELETED_CRIT_MESSAGE_HANDLER,
TERRITORY_DELETED_CRIT_ROUTING_KEY,
TERRITORY_DELETED_CRIT_QUEUE,
TERRITORY_DELETED_INFO_MESSAGE_HANDLER,
TERRITORY_DELETED_INFO_ROUTING_KEY,
TERRITORY_DELETED_INFO_QUEUE,
TERRITORY_HEALTH_CRIT_MESSAGE_HANDLER,
TERRITORY_HEALTH_CRIT_ROUTING_KEY,
TERRITORY_HEALTH_CRIT_QUEUE,
TERRITORY_READ_WARNING_MESSAGE_HANDLER,
TERRITORY_READ_WARNING_ROUTING_KEY,
TERRITORY_READ_WARNING_QUEUE,
TERRITORY_UPDATED_CRIT_MESSAGE_HANDLER,
TERRITORY_UPDATED_CRIT_ROUTING_KEY,
TERRITORY_UPDATED_CRIT_QUEUE,
TERRITORY_UPDATED_INFO_MESSAGE_HANDLER,
TERRITORY_UPDATED_INFO_ROUTING_KEY,
TERRITORY_UPDATED_INFO_QUEUE,
USER_CREATED_CRIT_MESSAGE_HANDLER,
USER_CREATED_CRIT_ROUTING_KEY,
USER_CREATED_CRIT_QUEUE,
USER_CREATED_INFO_MESSAGE_HANDLER,
USER_CREATED_INFO_ROUTING_KEY,
USER_CREATED_INFO_QUEUE,
USER_CREATED_WARNING_MESSAGE_HANDLER,
USER_CREATED_WARNING_ROUTING_KEY,
USER_CREATED_WARNING_QUEUE,
USER_DELETED_CRIT_MESSAGE_HANDLER,
USER_DELETED_CRIT_ROUTING_KEY,
USER_DELETED_CRIT_QUEUE,
USER_DELETED_INFO_MESSAGE_HANDLER,
USER_DELETED_INFO_ROUTING_KEY,
USER_DELETED_INFO_QUEUE,
USER_HEALTH_CRIT_MESSAGE_HANDLER,
USER_HEALTH_CRIT_ROUTING_KEY,
USER_HEALTH_CRIT_QUEUE,
USER_READ_WARNING_MESSAGE_HANDLER,
USER_READ_WARNING_ROUTING_KEY,
USER_READ_WARNING_QUEUE,
USER_UPDATED_CRIT_MESSAGE_HANDLER,
USER_UPDATED_CRIT_ROUTING_KEY,
USER_UPDATED_CRIT_QUEUE,
USER_UPDATED_INFO_MESSAGE_HANDLER,
USER_UPDATED_INFO_ROUTING_KEY,
USER_UPDATED_INFO_QUEUE,
} from '@src/app.constants';
const imports = [ const imports = [
MessageBrokerModule.forRootAsync({ MessageBrokerModule.forRootAsync({
@ -14,209 +143,182 @@ const imports = [
useFactory: async ( useFactory: async (
configService: ConfigService, configService: ConfigService,
): Promise<MessageBrokerModuleOptions> => ({ ): Promise<MessageBrokerModuleOptions> => ({
uri: configService.get<string>('MESSAGE_BROKER_URI'), uri: configService.get<string>('MESSAGE_BROKER_URI') as string,
exchange: configService.get<string>('MESSAGE_BROKER_EXCHANGE'), exchange: {
name: 'logger', name: configService.get<string>('MESSAGE_BROKER_EXCHANGE') as string,
durable: configService.get<boolean>(
'MESSAGE_BROKER_EXCHANGE_DURABILITY',
) as boolean,
},
name: SERVICE_NAME,
handlers: { handlers: {
loggingGatewayApiHealthCrit: { [GATEWAY_API_HEALTH_CRIT_MESSAGE_HANDLER]: {
routingKey: 'logging.gateway-api.health.crit', routingKey: GATEWAY_API_HEALTH_CRIT_ROUTING_KEY,
queue: 'logging-gateway-api-health-crit', queue: GATEWAY_API_HEALTH_CRIT_QUEUE,
}, },
loggingAdminApiHealthCrit: { [ADMIN_API_HEALTH_CRIT_MESSAGE_HANDLER]: {
routingKey: 'logging.admin-api.health.crit', routingKey: ADMIN_API_HEALTH_CRIT_ROUTING_KEY,
queue: 'logging-admin-api-health-crit', queue: ADMIN_API_HEALTH_CRIT_QUEUE,
}, },
loggingAdCreatedInfo: { [AD_CREATED_INFO_MESSAGE_HANDLER]: {
routingKey: 'logging.ad.created.info', routingKey: AD_CREATED_INFO_ROUTING_KEY,
queue: 'logging-ad-created-info', queue: AD_CREATED_INFO_QUEUE,
}, },
loggingAdCreatedWarning: { [AD_CREATED_WARNING_MESSAGE_HANDLER]: {
routingKey: 'logging.ad.created.warning', routingKey: AD_CREATED_WARNING_ROUTING_KEY,
queue: 'logging-ad-created-warning', queue: AD_CREATED_WARNING_QUEUE,
}, },
loggingAdCreatedCrit: { [AD_CREATED_CRIT_MESSAGE_HANDLER]: {
routingKey: 'logging.ad.created.crit', routingKey: AD_CREATED_CRIT_ROUTING_KEY,
queue: 'logging-ad-created-crit', queue: AD_CREATED_CRIT_QUEUE,
}, },
loggingAdDeletedInfo: { [AD_DELETED_INFO_MESSAGE_HANDLER]: {
routingKey: 'logging.ad.deleted.info', routingKey: AD_DELETED_INFO_ROUTING_KEY,
queue: 'logging-ad-deleted-info', queue: AD_DELETED_INFO_QUEUE,
}, },
loggingAdDeletedCrit: { [AD_DELETED_CRIT_MESSAGE_HANDLER]: {
routingKey: 'logging.ad.deleted.crit', routingKey: AD_DELETED_CRIT_ROUTING_KEY,
queue: 'logging-ad-deleted-crit', queue: AD_DELETED_CRIT_QUEUE,
}, },
loggingAdReadWarning: { [AD_READ_WARNING_MESSAGE_HANDLER]: {
routingKey: 'logging.ad.read.warning', routingKey: AD_READ_WARNING_ROUTING_KEY,
queue: 'logging-ad-read-warning', queue: AD_READ_WARNING_QUEUE,
}, },
loggingAdUpdatedInfo: { [AD_UPDATED_INFO_MESSAGE_HANDLER]: {
routingKey: 'logging.ad.updated.info', routingKey: AD_UPDATED_INFO_ROUTING_KEY,
queue: 'logging-ad-updated-info', queue: AD_UPDATED_INFO_QUEUE,
}, },
loggingAdUpdatedCrit: { [AD_UPDATED_CRIT_MESSAGE_HANDLER]: {
routingKey: 'logging.ad.updated.crit', routingKey: AD_UPDATED_CRIT_ROUTING_KEY,
queue: 'logging-ad-updated-crit', queue: AD_UPDATED_CRIT_QUEUE,
}, },
loggingAdHealthCrit: { [AD_HEALTH_CRIT_MESSAGE_HANDLER]: {
routingKey: 'logging.ad.health.crit', routingKey: AD_HEALTH_CRIT_ROUTING_KEY,
queue: 'logging-ad-health-crit', queue: AD_HEALTH_CRIT_QUEUE,
}, },
loggingAuthCreatedCrit: { [AUTH_CREATED_CRIT_MESSAGE_HANDLER]: {
routingKey: 'logging.auth.created.crit', routingKey: AUTH_CREATED_CRIT_ROUTING_KEY,
queue: 'logging-auth-created-crit', queue: AUTH_CREATED_CRIT_QUEUE,
}, },
loggingAuthDeletedCrit: { [AUTH_DELETED_CRIT_MESSAGE_HANDLER]: {
routingKey: 'logging.auth.deleted.crit', routingKey: AUTH_DELETED_CRIT_ROUTING_KEY,
queue: 'logging-auth-deleted-crit', queue: AUTH_DELETED_CRIT_QUEUE,
}, },
loggingAuthReadWarning: { [AUTH_READ_WARNING_MESSAGE_HANDLER]: {
routingKey: 'logging.auth.read.warning', routingKey: AUTH_READ_WARNING_ROUTING_KEY,
queue: 'logging-auth-read-warning', queue: AUTH_READ_WARNING_QUEUE,
}, },
loggingAuthUsernameCreatedWarning: { [AUTH_USERNAME_CREATED_WARNING_MESSAGE_HANDLER]: {
routingKey: 'logging.auth.username.created.warning', routingKey: AUTH_USERNAME_CREATED_WARNING_ROUTING_KEY,
queue: 'logging-auth-username-created-warning', queue: AUTH_USERNAME_CREATED_WARNING_QUEUE,
}, },
loggingAuthUsernameDeletedWarning: { [AUTH_USERNAME_DELETED_WARNING_MESSAGE_HANDLER]: {
routingKey: 'logging.auth.username.deleted.warning', routingKey: AUTH_USERNAME_DELETED_WARNING_ROUTING_KEY,
queue: 'logging-auth-username-deleted-warning', queue: AUTH_USERNAME_DELETED_WARNING_QUEUE,
}, },
loggingAuthUsernameReadWarning: { [AUTH_USERNAME_READ_WARNING_MESSAGE_HANDLER]: {
routingKey: 'logging.auth.username.read.warning', routingKey: AUTH_USERNAME_READ_WARNING_ROUTING_KEY,
queue: 'logging-auth-username-read-warning', queue: AUTH_USERNAME_READ_WARNING_QUEUE,
}, },
loggingAuthPasswordUpdatedWarning: { [AUTH_PASSWORD_UPDATED_WARNING_MESSAGE_HANDLER]: {
routingKey: 'logging.auth.password.updated.warning', routingKey: AUTH_PASSWORD_UPDATED_WARNING_ROUTING_KEY,
queue: 'logging-auth-password-updated-warning', queue: AUTH_PASSWORD_UPDATED_WARNING_QUEUE,
}, },
loggingAuthUsernameUpdatedWarning: { [AUTH_USERNAME_UPDATED_WARNING_MESSAGE_HANDLER]: {
routingKey: 'logging.auth.username.updated.warning', routingKey: AUTH_USERNAME_UPDATED_WARNING_ROUTING_KEY,
queue: 'logging-auth-username-updated-warning', queue: AUTH_USERNAME_UPDATED_WARNING_QUEUE,
}, },
loggingAuthHealthCrit: { [AUTH_HEALTH_CRIT_MESSAGE_HANDLER]: {
routingKey: 'logging.auth.health.crit', routingKey: AUTH_HEALTH_CRIT_ROUTING_KEY,
queue: 'logging-auth-health-crit', queue: AUTH_HEALTH_CRIT_QUEUE,
}, },
loggingConfigurationCreatedInfo: { [CONFIGURATION_HEALTH_CRIT_MESSAGE_HANDLER]: {
routingKey: 'logging.configuration.created.info', routingKey: CONFIGURATION_HEALTH_CRIT_ROUTING_KEY,
queue: 'logging-configuration-created-info', queue: CONFIGURATION_HEALTH_CRIT_QUEUE,
}, },
loggingConfigurationCreatedWarning: { [LOGGER_HEALTH_CRIT_MESSAGE_HANDLER]: {
routingKey: 'logging.configuration.created.warning', routingKey: LOGGER_HEALTH_CRIT_ROUTING_KEY,
queue: 'logging-configuration-created-warning', queue: LOGGER_HEALTH_CRIT_QUEUE,
}, },
loggingConfigurationCreatedCrit: { [MATCHER_AD_CRIT_MESSAGE_HANDLER]: {
routingKey: 'logging.configuration.created.crit', routingKey: MATCHER_AD_CRIT_ROUTING_KEY,
queue: 'logging-configuration-created-crit', queue: MATCHER_AD_CRIT_QUEUE,
}, },
loggingConfigurationDeletedInfo: { [MATCHER_MATCH_CRIT_MESSAGE_HANDLER]: {
routingKey: 'logging.configuration.deleted.info', routingKey: MATCHER_MATCH_CRIT_ROUTING_KEY,
queue: 'logging-configuration-deleted-info', queue: MATCHER_MATCH_CRIT_QUEUE,
}, },
loggingConfigurationDeletedCrit: { [TERRITORY_CREATED_INFO_MESSAGE_HANDLER]: {
routingKey: 'logging.configuration.deleted.crit', routingKey: TERRITORY_CREATED_INFO_ROUTING_KEY,
queue: 'logging-configuration-deleted-crit', queue: TERRITORY_CREATED_INFO_QUEUE,
}, },
loggingConfigurationReadWarning: { [TERRITORY_CREATED_WARNING_MESSAGE_HANDLER]: {
routingKey: 'logging.configuration.read.warning', routingKey: TERRITORY_CREATED_WARNING_ROUTING_KEY,
queue: 'logging-configuration-read-warning', queue: TERRITORY_CREATED_WARNING_QUEUE,
}, },
loggingConfigurationUpdatedInfo: { [TERRITORY_CREATED_CRIT_MESSAGE_HANDLER]: {
routingKey: 'logging.configuration.updated.info', routingKey: TERRITORY_CREATED_CRIT_ROUTING_KEY,
queue: 'logging-configuration-updated-info', queue: TERRITORY_CREATED_CRIT_QUEUE,
}, },
loggingConfigurationUpdatedCrit: { [TERRITORY_DELETED_INFO_MESSAGE_HANDLER]: {
routingKey: 'logging.configuration.updated.crit', routingKey: TERRITORY_DELETED_INFO_ROUTING_KEY,
queue: 'logging-configuration-updated-crit', queue: TERRITORY_DELETED_INFO_QUEUE,
}, },
loggingConfigurationHealthCrit: { [TERRITORY_DELETED_CRIT_MESSAGE_HANDLER]: {
routingKey: 'logging.configuration.health.crit', routingKey: TERRITORY_DELETED_CRIT_ROUTING_KEY,
queue: 'logging-configuration-health-crit', queue: TERRITORY_DELETED_CRIT_QUEUE,
}, },
loggingLoggerHealthCrit: { [TERRITORY_READ_WARNING_MESSAGE_HANDLER]: {
routingKey: 'logging.logger.health.crit', routingKey: TERRITORY_READ_WARNING_ROUTING_KEY,
queue: 'logging-logger-health-crit', queue: TERRITORY_READ_WARNING_QUEUE,
}, },
loggingMatcherAdCrit: { [TERRITORY_UPDATED_INFO_MESSAGE_HANDLER]: {
routingKey: 'logging.matcher.ad.crit', routingKey: TERRITORY_UPDATED_INFO_ROUTING_KEY,
queue: 'logging-matcher-ad-crit', queue: TERRITORY_UPDATED_INFO_QUEUE,
}, },
loggingMatcherMatchCrit: { [TERRITORY_UPDATED_CRIT_MESSAGE_HANDLER]: {
routingKey: 'logging.matcher.match.crit', routingKey: TERRITORY_UPDATED_CRIT_ROUTING_KEY,
queue: 'logging-matcher-match-crit', queue: TERRITORY_UPDATED_CRIT_QUEUE,
}, },
loggingTerritoryCreatedInfo: { [TERRITORY_HEALTH_CRIT_MESSAGE_HANDLER]: {
routingKey: 'logging.territory.created.info', routingKey: TERRITORY_HEALTH_CRIT_ROUTING_KEY,
queue: 'logging-territory-created-info', queue: TERRITORY_HEALTH_CRIT_QUEUE,
}, },
loggingTerritoryCreatedWarning: { [USER_CREATED_INFO_MESSAGE_HANDLER]: {
routingKey: 'logging.territory.created.warning', routingKey: USER_CREATED_INFO_ROUTING_KEY,
queue: 'logging-territory-created-warning', queue: USER_CREATED_INFO_QUEUE,
}, },
loggingTerritoryCreatedCrit: { [USER_CREATED_WARNING_MESSAGE_HANDLER]: {
routingKey: 'logging.territory.created.crit', routingKey: USER_CREATED_WARNING_ROUTING_KEY,
queue: 'logging-territory-created-crit', queue: USER_CREATED_WARNING_QUEUE,
}, },
loggingTerritoryDeletedInfo: { [USER_CREATED_CRIT_MESSAGE_HANDLER]: {
routingKey: 'logging.territory.deleted.info', routingKey: USER_CREATED_CRIT_ROUTING_KEY,
queue: 'logging-territory-deleted-info', queue: USER_CREATED_CRIT_QUEUE,
}, },
loggingTerritoryDeletedCrit: { [USER_DELETED_INFO_MESSAGE_HANDLER]: {
routingKey: 'logging.territory.deleted.crit', routingKey: USER_DELETED_INFO_ROUTING_KEY,
queue: 'logging-territory-deleted-crit', queue: USER_DELETED_INFO_QUEUE,
}, },
loggingTerritoryReadWarning: { [USER_DELETED_CRIT_MESSAGE_HANDLER]: {
routingKey: 'logging.territory.read.warning', routingKey: USER_DELETED_CRIT_ROUTING_KEY,
queue: 'logging-territory-read-warning', queue: USER_DELETED_CRIT_QUEUE,
}, },
loggingTerritoryUpdatedInfo: { [USER_READ_WARNING_MESSAGE_HANDLER]: {
routingKey: 'logging.territory.updated.info', routingKey: USER_READ_WARNING_ROUTING_KEY,
queue: 'logging-territory-updated-info', queue: USER_READ_WARNING_QUEUE,
}, },
loggingTerritoryUpdatedCrit: { [USER_UPDATED_INFO_MESSAGE_HANDLER]: {
routingKey: 'logging.territory.updated.crit', routingKey: USER_UPDATED_INFO_ROUTING_KEY,
queue: 'logging-territory-updated-crit', queue: USER_UPDATED_INFO_QUEUE,
}, },
loggingTerritoryHealthCrit: { [USER_UPDATED_CRIT_MESSAGE_HANDLER]: {
routingKey: 'logging.territory.health.crit', routingKey: USER_UPDATED_CRIT_ROUTING_KEY,
queue: 'logging-territory-health-crit', queue: USER_UPDATED_CRIT_QUEUE,
}, },
loggingUserCreatedInfo: { [USER_HEALTH_CRIT_MESSAGE_HANDLER]: {
routingKey: 'logging.user.created.info', routingKey: USER_HEALTH_CRIT_ROUTING_KEY,
queue: 'logging-user-created-info', queue: USER_HEALTH_CRIT_QUEUE,
},
loggingUserCreatedWarning: {
routingKey: 'logging.user.created.warning',
queue: 'logging-user-created-warning',
},
loggingUserCreatedCrit: {
routingKey: 'logging.user.created.crit',
queue: 'logging-user-created-crit',
},
loggingUserDeletedInfo: {
routingKey: 'logging.user.deleted.info',
queue: 'logging-user-deleted-info',
},
loggingUserDeletedCrit: {
routingKey: 'logging.user.deleted.crit',
queue: 'logging-user-deleted-crit',
},
loggingUserReadWarning: {
routingKey: 'logging.user.read.warning',
queue: 'logging-user-read-warning',
},
loggingUserUpdatedInfo: {
routingKey: 'logging.user.updated.info',
queue: 'logging-user-updated-info',
},
loggingUserUpdatedCrit: {
routingKey: 'logging.user.updated.crit',
queue: 'logging-user-updated-crit',
},
loggingUserHealthCrit: {
routingKey: 'logging.user.health.crit',
queue: 'logging-user-health-crit',
}, },
}, },
}), }),

View File

@ -12,12 +12,13 @@
"baseUrl": "./", "baseUrl": "./",
"incremental": true, "incremental": true,
"skipLibCheck": true, "skipLibCheck": true,
"strictNullChecks": false, "strictNullChecks": true,
"noImplicitAny": false, "noImplicitAny": true,
"strictBindCallApply": false, "strictBindCallApply": false,
"forceConsistentCasingInFileNames": false, "forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": false, "noFallthroughCasesInSwitch": false,
"paths": { "paths": {
"@libs/*": ["src/libs/*"],
"@modules/*": ["src/modules/*"], "@modules/*": ["src/modules/*"],
"@src/*": ["src/*"] "@src/*": ["src/*"]
} }