From de8db8b6484a3247b622b9a52877f84e413c6956 Mon Sep 17 00:00:00 2001 From: sbriat Date: Thu, 13 Jul 2023 10:29:18 +0200 Subject: [PATCH 1/2] remove unused code --- src/utils/pipes/rpc.validation-pipe.ts | 14 ------------ .../unit/rpc-validation-pipe.usecase.spec.ts | 22 ------------------- 2 files changed, 36 deletions(-) delete mode 100644 src/utils/pipes/rpc.validation-pipe.ts delete mode 100644 src/utils/tests/unit/rpc-validation-pipe.usecase.spec.ts diff --git a/src/utils/pipes/rpc.validation-pipe.ts b/src/utils/pipes/rpc.validation-pipe.ts deleted file mode 100644 index f2b8c19..0000000 --- a/src/utils/pipes/rpc.validation-pipe.ts +++ /dev/null @@ -1,14 +0,0 @@ -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), - }); - }; - } -} diff --git a/src/utils/tests/unit/rpc-validation-pipe.usecase.spec.ts b/src/utils/tests/unit/rpc-validation-pipe.usecase.spec.ts deleted file mode 100644 index 510e9c4..0000000 --- a/src/utils/tests/unit/rpc-validation-pipe.usecase.spec.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { ArgumentMetadata } from '@nestjs/common'; -import { RpcValidationPipe } from '../../pipes/rpc.validation-pipe'; -import { ValidateAuthenticationRequestDto } from '@modules/authentication/interface/grpc-controllers/dtos/validate-authentication.request.dto'; - -describe('RpcValidationPipe', () => { - it('should not validate request', async () => { - const target: RpcValidationPipe = new RpcValidationPipe({ - whitelist: true, - forbidUnknownValues: false, - }); - const metadata: ArgumentMetadata = { - type: 'body', - metatype: ValidateAuthenticationRequestDto, - data: '', - }; - await target - .transform({}, metadata) - .catch((err) => { - expect(err.message).toEqual('Rpc Exception'); - }); - }); -}); From acdf134fac38071d196e50b41d11c713f8ba32fb Mon Sep 17 00:00:00 2001 From: sbriat Date: Thu, 13 Jul 2023 10:29:24 +0200 Subject: [PATCH 2/2] 0.1.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index b8406bd..79fd4e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@mobicoop/auth", - "version": "0.1.0", + "version": "0.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@mobicoop/auth", - "version": "0.1.0", + "version": "0.1.1", "license": "AGPL", "dependencies": { "@automapper/classes": "^8.7.7", diff --git a/package.json b/package.json index efcee6e..eac2be2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mobicoop/auth", - "version": "0.1.0", + "version": "0.1.1", "description": "Mobicoop V3 Auth Service", "author": "sbriat", "private": true,