mirror of
https://gitlab.com/mobicoop/v3/service/auth.git
synced 2026-01-02 21:02:41 +00:00
fix validation
This commit is contained in:
@@ -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) {
|
||||
|
||||
14
src/modules/auth/adapters/primaries/rpc.validation-pipe.ts
Normal file
14
src/modules/auth/adapters/primaries/rpc.validation-pipe.ts
Normal file
@@ -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'),
|
||||
|
||||
Reference in New Issue
Block a user