fix validation
This commit is contained in:
parent
5e4b777ab8
commit
a34d51a524
2
.env
2
.env
|
@ -7,8 +7,6 @@ SERVICE_PORT=5002
|
|||
DATABASE_URL="postgresql://auth:auth@v3-auth-db:5432/auth?schema=public"
|
||||
|
||||
# RABBIT MQ
|
||||
RMQ_EXCHANGE_NAME=user
|
||||
RMQ_EXCHANGE_TYPE=topic
|
||||
RMQ_URI=amqp://v3-gateway-broker:5672
|
||||
|
||||
# POSTGRES
|
||||
|
|
|
@ -7,8 +7,6 @@ SERVICE_PORT=5002
|
|||
DATABASE_URL="postgresql://auth:auth@db:5432/auth?schema=public"
|
||||
|
||||
# RABBIT MQ
|
||||
RMQ_EXCHANGES=user
|
||||
RMQ_EXCHANGE_TYPE=topic
|
||||
RMQ_URI=amqp://localhost:5672
|
||||
|
||||
# POSTGRES
|
||||
|
|
|
@ -13,7 +13,7 @@ export class AuthMessagerController {
|
|||
|
||||
@RabbitSubscribe({
|
||||
exchange: 'user',
|
||||
routingKey: 'user.update',
|
||||
routingKey: 'update',
|
||||
queue: 'auth-user-update',
|
||||
})
|
||||
public async userUpdatedHandler(message: string) {
|
||||
|
@ -41,7 +41,7 @@ export class AuthMessagerController {
|
|||
|
||||
@RabbitSubscribe({
|
||||
exchange: 'user',
|
||||
routingKey: 'user.delete',
|
||||
routingKey: 'delete',
|
||||
queue: 'auth-user-delete',
|
||||
})
|
||||
public async userDeletedHandler(message: string) {
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
import { Injectable, ValidationPipe } from '@nestjs/common';
|
||||
import { RpcException } from '@nestjs/microservices';
|
||||
|
||||
@Injectable()
|
||||
export class RpcValidationPipe extends ValidationPipe {
|
||||
createExceptionFactory() {
|
||||
return (validationErrors = []) => {
|
||||
return new RpcException({
|
||||
code: 3,
|
||||
message: this.flattenValidationErrors(validationErrors),
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
|
@ -25,8 +25,8 @@ import { AuthMessagerController } from './adapters/primaries/auth-messager.contr
|
|||
useFactory: async (configService: ConfigService) => ({
|
||||
exchanges: [
|
||||
{
|
||||
name: configService.get<string>('RMQ_EXCHANGE_NAME'),
|
||||
type: configService.get<string>('RMQ_EXCHANGE_TYPE'),
|
||||
name: 'user',
|
||||
type: 'topic',
|
||||
},
|
||||
],
|
||||
uri: configService.get<string>('RMQ_URI'),
|
||||
|
|
Loading…
Reference in New Issue