fix / refactoring
This commit is contained in:
parent
8ddf19df55
commit
1b5ed98ee5
|
@ -41,8 +41,6 @@ export class AdController {
|
||||||
|
|
||||||
@GrpcMethod('AdsService', 'Create')
|
@GrpcMethod('AdsService', 'Create')
|
||||||
async createAd(data: CreateAdRequest): Promise<AdPresenter> {
|
async createAd(data: CreateAdRequest): Promise<AdPresenter> {
|
||||||
console.log('controler');
|
|
||||||
console.log(data);
|
|
||||||
try {
|
try {
|
||||||
const ad = await this._commandBus.execute(new CreateAdCommand(data));
|
const ad = await this._commandBus.execute(new CreateAdCommand(data));
|
||||||
return this._mapper.map(ad, Ad, AdPresenter);
|
return this._mapper.map(ad, Ad, AdPresenter);
|
||||||
|
|
|
@ -11,7 +11,7 @@ export function hasProperDriverSeats(args: ValidationArguments) {
|
||||||
typeof args.object['seatsDriver'] === 'number'
|
typeof args.object['seatsDriver'] === 'number'
|
||||||
)
|
)
|
||||||
return args.object['seatsDriver'] > 0;
|
return args.object['seatsDriver'] > 0;
|
||||||
else if (
|
if (
|
||||||
(args.object['driver'] === false ||
|
(args.object['driver'] === false ||
|
||||||
args.object['driver'] === null ||
|
args.object['driver'] === null ||
|
||||||
args.object['driver'] === undefined) &&
|
args.object['driver'] === undefined) &&
|
||||||
|
@ -20,9 +20,9 @@ export function hasProperDriverSeats(args: ValidationArguments) {
|
||||||
args.object['seatsDriver'] === undefined)
|
args.object['seatsDriver'] === undefined)
|
||||||
)
|
)
|
||||||
return true;
|
return true;
|
||||||
else return false;
|
return false;
|
||||||
}
|
}
|
||||||
/* istanbul ignore next */
|
|
||||||
export function HasProperDriverSeats(
|
export function HasProperDriverSeats(
|
||||||
validationOptions?: ValidationOptions,
|
validationOptions?: ValidationOptions,
|
||||||
): PropertyDecorator {
|
): PropertyDecorator {
|
||||||
|
|
|
@ -22,7 +22,7 @@ export function hasProperPassengerSeats(args: ValidationArguments) {
|
||||||
return true;
|
return true;
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
/* istanbul ignore next */
|
|
||||||
export function HasProperPassengerSeats(
|
export function HasProperPassengerSeats(
|
||||||
validationOptions?: ValidationOptions,
|
validationOptions?: ValidationOptions,
|
||||||
): PropertyDecorator {
|
): PropertyDecorator {
|
||||||
|
|
|
@ -28,12 +28,9 @@ function isRecurrent(args: ValidationArguments): boolean {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const isPunctualOrRecurrent = (args: ValidationArguments): boolean => {
|
export const isPunctualOrRecurrent = (args: ValidationArguments): boolean => {
|
||||||
console.log('validator ');
|
|
||||||
console.log(args.object);
|
|
||||||
return isPunctual(args) || isRecurrent(args);
|
return isPunctual(args) || isRecurrent(args);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* istanbul ignore next */
|
|
||||||
export function IsPunctualOrRecurrent(
|
export function IsPunctualOrRecurrent(
|
||||||
validationOptions?: ValidationOptions,
|
validationOptions?: ValidationOptions,
|
||||||
): PropertyDecorator {
|
): PropertyDecorator {
|
||||||
|
|
Loading…
Reference in New Issue