mirror of
https://gitlab.com/mobicoop/v3/service/auth.git
synced 2026-01-07 11:12:40 +00:00
fix validation
This commit is contained in:
2
.env
2
.env
@@ -7,8 +7,6 @@ SERVICE_PORT=5002
|
|||||||
DATABASE_URL="postgresql://auth:auth@v3-auth-db:5432/auth?schema=public"
|
DATABASE_URL="postgresql://auth:auth@v3-auth-db:5432/auth?schema=public"
|
||||||
|
|
||||||
# RABBIT MQ
|
# RABBIT MQ
|
||||||
RMQ_EXCHANGE_NAME=user
|
|
||||||
RMQ_EXCHANGE_TYPE=topic
|
|
||||||
RMQ_URI=amqp://v3-gateway-broker:5672
|
RMQ_URI=amqp://v3-gateway-broker:5672
|
||||||
|
|
||||||
# POSTGRES
|
# POSTGRES
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ SERVICE_PORT=5002
|
|||||||
DATABASE_URL="postgresql://auth:auth@db:5432/auth?schema=public"
|
DATABASE_URL="postgresql://auth:auth@db:5432/auth?schema=public"
|
||||||
|
|
||||||
# RABBIT MQ
|
# RABBIT MQ
|
||||||
RMQ_EXCHANGES=user
|
|
||||||
RMQ_EXCHANGE_TYPE=topic
|
|
||||||
RMQ_URI=amqp://localhost:5672
|
RMQ_URI=amqp://localhost:5672
|
||||||
|
|
||||||
# POSTGRES
|
# POSTGRES
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export class AuthMessagerController {
|
|||||||
|
|
||||||
@RabbitSubscribe({
|
@RabbitSubscribe({
|
||||||
exchange: 'user',
|
exchange: 'user',
|
||||||
routingKey: 'user.update',
|
routingKey: 'update',
|
||||||
queue: 'auth-user-update',
|
queue: 'auth-user-update',
|
||||||
})
|
})
|
||||||
public async userUpdatedHandler(message: string) {
|
public async userUpdatedHandler(message: string) {
|
||||||
@@ -41,7 +41,7 @@ export class AuthMessagerController {
|
|||||||
|
|
||||||
@RabbitSubscribe({
|
@RabbitSubscribe({
|
||||||
exchange: 'user',
|
exchange: 'user',
|
||||||
routingKey: 'user.delete',
|
routingKey: 'delete',
|
||||||
queue: 'auth-user-delete',
|
queue: 'auth-user-delete',
|
||||||
})
|
})
|
||||||
public async userDeletedHandler(message: string) {
|
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) => ({
|
useFactory: async (configService: ConfigService) => ({
|
||||||
exchanges: [
|
exchanges: [
|
||||||
{
|
{
|
||||||
name: configService.get<string>('RMQ_EXCHANGE_NAME'),
|
name: 'user',
|
||||||
type: configService.get<string>('RMQ_EXCHANGE_TYPE'),
|
type: 'topic',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
uri: configService.get<string>('RMQ_URI'),
|
uri: configService.get<string>('RMQ_URI'),
|
||||||
|
|||||||
Reference in New Issue
Block a user