add ad service

This commit is contained in:
sbriat 2023-05-04 12:35:05 +02:00
parent 6b8ea07929
commit 9b612ce083
1 changed files with 28 additions and 28 deletions

View File

@ -6,91 +6,91 @@ import { level } from './logger/level.enum';
import loggerOptions from './logger/logger'; import loggerOptions from './logger/logger';
@Controller() @Controller()
export class UserController { export class AdController {
constructor( constructor(
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger, @Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
) {} ) {}
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingUserCreateInfo', name: 'loggingAdCreateInfo',
}) })
public async userCreatedInfoHandler(message: string) { public async adCreatedInfoHandler(message: string) {
this.logger.configure(loggerOptions('user', level.info, 'info', 'create')); this.logger.configure(loggerOptions('ad', level.info, 'info', 'create'));
this.logger.info(JSON.parse(message)); this.logger.info(JSON.parse(message));
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingUserCreateWarning', name: 'loggingAdCreateWarning',
}) })
public async userCreatedWarningHandler(message: string) { public async adCreatedWarningHandler(message: string) {
this.logger.configure( this.logger.configure(
loggerOptions('user', level.warning, 'warning', 'create'), loggerOptions('ad', level.warning, 'warning', 'create'),
); );
this.logger.warning(JSON.parse(message)); this.logger.warning(JSON.parse(message));
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingUserCreateCrit', name: 'loggingAdCreateCrit',
}) })
public async userCreatedCriticalHandler(message: string) { public async adCreatedCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(
loggerOptions('user', level.crit, 'critical', 'create'), loggerOptions('ad', level.crit, 'critical', 'create'),
); );
this.logger.crit(JSON.parse(message)); this.logger.crit(JSON.parse(message));
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingUserDeleteInfo', name: 'loggingAdDeleteInfo',
}) })
public async userDeletedInfoHandler(message: string) { public async adDeletedInfoHandler(message: string) {
this.logger.configure(loggerOptions('user', level.info, 'info', 'delete')); this.logger.configure(loggerOptions('ad', level.info, 'info', 'delete'));
this.logger.info(JSON.parse(message)); this.logger.info(JSON.parse(message));
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingUserDeleteCrit', name: 'loggingAdDeleteCrit',
}) })
public async userDeletedCriticalHandler(message: string) { public async adDeletedCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(
loggerOptions('user', level.crit, 'critical', 'delete'), loggerOptions('ad', level.crit, 'critical', 'delete'),
); );
this.logger.crit(JSON.parse(message)); this.logger.crit(JSON.parse(message));
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingUserReadWarning', name: 'loggingAdReadWarning',
}) })
public async userReadWarningHandler(message: string) { public async adReadWarningHandler(message: string) {
this.logger.configure( this.logger.configure(
loggerOptions('user', level.warning, 'warning', 'read'), loggerOptions('ad', level.warning, 'warning', 'read'),
); );
this.logger.warning(JSON.parse(message)); this.logger.warning(JSON.parse(message));
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingUserUpdateInfo', name: 'loggingAdUpdateInfo',
}) })
public async userUpdatedInfoHandler(message: string) { public async adUpdatedInfoHandler(message: string) {
this.logger.configure(loggerOptions('user', level.info, 'info', 'update')); this.logger.configure(loggerOptions('ad', level.info, 'info', 'update'));
this.logger.info(JSON.parse(message)); this.logger.info(JSON.parse(message));
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingUserUpdateCrit', name: 'loggingAdUpdateCrit',
}) })
public async userUpdatedCriticalHandler(message: string) { public async adUpdatedCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(
loggerOptions('user', level.crit, 'critical', 'update'), loggerOptions('ad', level.crit, 'critical', 'update'),
); );
this.logger.crit(JSON.parse(message)); this.logger.crit(JSON.parse(message));
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingUserHealthCrit', name: 'loggingAdHealthCrit',
}) })
public async userHealthCriticalHandler(message: string) { public async adHealthCriticalHandler(message: string) {
this.logger.configure( this.logger.configure(
loggerOptions('user', level.crit, 'critical', 'health'), loggerOptions('ad', level.crit, 'critical', 'health'),
); );
this.logger.crit(JSON.parse(message)); this.logger.crit(JSON.parse(message));
} }