From 3f11f16e595304d5dc67bdcca85745dccb6da338 Mon Sep 17 00:00:00 2001 From: Gsk54 Date: Fri, 23 Dec 2022 15:49:35 +0100 Subject: [PATCH] rename message broker interface --- .../users/adapters/primaries/users.controller.ts | 12 ++++++------ .../users/adapters/secondaries/logging.messager.ts | 2 +- .../users/adapters/secondaries/user.messager.ts | 2 +- src/modules/users/domain/dtos/create-user.request.ts | 6 +++--- .../{user-messager.ts => message-broker.ts} | 0 5 files changed, 11 insertions(+), 11 deletions(-) rename src/modules/users/domain/interfaces/{user-messager.ts => message-broker.ts} (100%) diff --git a/src/modules/users/adapters/primaries/users.controller.ts b/src/modules/users/adapters/primaries/users.controller.ts index 717b683..37167eb 100644 --- a/src/modules/users/adapters/primaries/users.controller.ts +++ b/src/modules/users/adapters/primaries/users.controller.ts @@ -18,6 +18,12 @@ import { UserPresenter } from './user.presenter'; import { ICollection } from '../../../database/src/interfaces/collection.interface'; import { RpcValidationPipe } from './rpc.validation-pipe'; +@UsePipes( + new RpcValidationPipe({ + whitelist: true, + forbidUnknownValues: false, + }), +) @Controller() export class UsersController { constructor( @@ -72,12 +78,6 @@ export class UsersController { } } - @UsePipes( - new RpcValidationPipe({ - whitelist: true, - forbidUnknownValues: false, - }), - ) @GrpcMethod('UsersService', 'Update') async updateUser(data: UpdateUserRequest): Promise { try { diff --git a/src/modules/users/adapters/secondaries/logging.messager.ts b/src/modules/users/adapters/secondaries/logging.messager.ts index 7d95c7c..00988ec 100644 --- a/src/modules/users/adapters/secondaries/logging.messager.ts +++ b/src/modules/users/adapters/secondaries/logging.messager.ts @@ -1,6 +1,6 @@ import { AmqpConnection } from '@golevelup/nestjs-rabbitmq'; import { Injectable } from '@nestjs/common'; -import { IMessageBroker } from '../../domain/interfaces/user-messager'; +import { IMessageBroker } from '../../domain/interfaces/message-broker'; @Injectable() export class LoggingMessager extends IMessageBroker { diff --git a/src/modules/users/adapters/secondaries/user.messager.ts b/src/modules/users/adapters/secondaries/user.messager.ts index f807d6d..4653d9d 100644 --- a/src/modules/users/adapters/secondaries/user.messager.ts +++ b/src/modules/users/adapters/secondaries/user.messager.ts @@ -1,6 +1,6 @@ import { AmqpConnection } from '@golevelup/nestjs-rabbitmq'; import { Injectable } from '@nestjs/common'; -import { IMessageBroker } from '../../domain/interfaces/user-messager'; +import { IMessageBroker } from '../../domain/interfaces/message-broker'; @Injectable() export class UserMessager extends IMessageBroker { diff --git a/src/modules/users/domain/dtos/create-user.request.ts b/src/modules/users/domain/dtos/create-user.request.ts index 6859b61..5071326 100644 --- a/src/modules/users/domain/dtos/create-user.request.ts +++ b/src/modules/users/domain/dtos/create-user.request.ts @@ -1,5 +1,5 @@ import { AutoMap } from '@automapper/classes'; -import { IsOptional, IsString } from 'class-validator'; +import { IsEmail, IsOptional, IsPhoneNumber, IsString } from 'class-validator'; export class CreateUserRequest { @IsString() @@ -17,12 +17,12 @@ export class CreateUserRequest { @AutoMap() lastName?: string; - @IsString() + @IsEmail() @IsOptional() @AutoMap() email?: string; - @IsString() + @IsPhoneNumber() @IsOptional() @AutoMap() phone?: string; diff --git a/src/modules/users/domain/interfaces/user-messager.ts b/src/modules/users/domain/interfaces/message-broker.ts similarity index 100% rename from src/modules/users/domain/interfaces/user-messager.ts rename to src/modules/users/domain/interfaces/message-broker.ts