mirror of
https://gitlab.com/mobicoop/v3/service/auth.git
synced 2026-02-22 16:30:44 +00:00
Merge branch 'removeUtils' into 'main'
Remove utils See merge request v3/service/auth!42
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@mobicoop/auth",
|
"name": "@mobicoop/auth",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@mobicoop/auth",
|
"name": "@mobicoop/auth",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"license": "AGPL",
|
"license": "AGPL",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@automapper/classes": "^8.7.7",
|
"@automapper/classes": "^8.7.7",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@mobicoop/auth",
|
"name": "@mobicoop/auth",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"description": "Mobicoop V3 Auth Service",
|
"description": "Mobicoop V3 Auth Service",
|
||||||
"author": "sbriat",
|
"author": "sbriat",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
|||||||
@@ -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),
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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(<ValidateAuthenticationRequestDto>{}, metadata)
|
|
||||||
.catch((err) => {
|
|
||||||
expect(err.message).toEqual('Rpc Exception');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user