From 1b5ed98ee57766f9e14ed092351e9b78c4162a86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Chevalier?= Date: Wed, 31 May 2023 09:09:58 +0200 Subject: [PATCH] fix / refactoring --- src/modules/ad/adapters/primaries/ad.controller.ts | 2 -- .../ad/domain/dtos/validators/has-driver-seats.validator.ts | 6 +++--- .../domain/dtos/validators/has-passenger-seats.validator.ts | 2 +- .../dtos/validators/is-punctual-or-recurrent.validator.ts | 3 --- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/modules/ad/adapters/primaries/ad.controller.ts b/src/modules/ad/adapters/primaries/ad.controller.ts index 9f82c1b..f0ce22d 100644 --- a/src/modules/ad/adapters/primaries/ad.controller.ts +++ b/src/modules/ad/adapters/primaries/ad.controller.ts @@ -41,8 +41,6 @@ export class AdController { @GrpcMethod('AdsService', 'Create') async createAd(data: CreateAdRequest): Promise { - console.log('controler'); - console.log(data); try { const ad = await this._commandBus.execute(new CreateAdCommand(data)); return this._mapper.map(ad, Ad, AdPresenter); diff --git a/src/modules/ad/domain/dtos/validators/has-driver-seats.validator.ts b/src/modules/ad/domain/dtos/validators/has-driver-seats.validator.ts index 9a6981c..8642b87 100644 --- a/src/modules/ad/domain/dtos/validators/has-driver-seats.validator.ts +++ b/src/modules/ad/domain/dtos/validators/has-driver-seats.validator.ts @@ -11,7 +11,7 @@ export function hasProperDriverSeats(args: ValidationArguments) { typeof args.object['seatsDriver'] === 'number' ) return args.object['seatsDriver'] > 0; - else if ( + if ( (args.object['driver'] === false || args.object['driver'] === null || args.object['driver'] === undefined) && @@ -20,9 +20,9 @@ export function hasProperDriverSeats(args: ValidationArguments) { args.object['seatsDriver'] === undefined) ) return true; - else return false; + return false; } -/* istanbul ignore next */ + export function HasProperDriverSeats( validationOptions?: ValidationOptions, ): PropertyDecorator { diff --git a/src/modules/ad/domain/dtos/validators/has-passenger-seats.validator.ts b/src/modules/ad/domain/dtos/validators/has-passenger-seats.validator.ts index ba6d521..74cf588 100644 --- a/src/modules/ad/domain/dtos/validators/has-passenger-seats.validator.ts +++ b/src/modules/ad/domain/dtos/validators/has-passenger-seats.validator.ts @@ -22,7 +22,7 @@ export function hasProperPassengerSeats(args: ValidationArguments) { return true; else return false; } -/* istanbul ignore next */ + export function HasProperPassengerSeats( validationOptions?: ValidationOptions, ): PropertyDecorator { diff --git a/src/modules/ad/domain/dtos/validators/is-punctual-or-recurrent.validator.ts b/src/modules/ad/domain/dtos/validators/is-punctual-or-recurrent.validator.ts index a97d696..d740c24 100644 --- a/src/modules/ad/domain/dtos/validators/is-punctual-or-recurrent.validator.ts +++ b/src/modules/ad/domain/dtos/validators/is-punctual-or-recurrent.validator.ts @@ -28,12 +28,9 @@ function isRecurrent(args: ValidationArguments): boolean { } export const isPunctualOrRecurrent = (args: ValidationArguments): boolean => { - console.log('validator '); - console.log(args.object); return isPunctual(args) || isRecurrent(args); }; -/* istanbul ignore next */ export function IsPunctualOrRecurrent( validationOptions?: ValidationOptions, ): PropertyDecorator {