use strict null checks

This commit is contained in:
sbriat
2023-08-25 15:16:33 +02:00
parent effe51b9a2
commit f15e7d11b1
16 changed files with 91 additions and 165 deletions

View File

@@ -14,26 +14,20 @@ import { RouteResponseDto } from './interface/dtos/route.response.dto';
export class RouteMapper
implements Mapper<RouteEntity, undefined, undefined, RouteResponseDto>
{
toPersistence = (): undefined => {
return undefined;
};
// eslint-disable-next-line @typescript-eslint/no-unused-vars
toDomain = (): undefined => {
return undefined;
};
// eslint-disable-next-line @typescript-eslint/no-unused-vars
toResponse = (entity: RouteEntity): RouteResponseDto => {
const response = new RouteResponseDto();
response.driverDistance = Math.round(entity.getProps().driverDistance);
response.driverDuration = Math.round(entity.getProps().driverDuration);
response.passengerDistance = Math.round(
entity.getProps().passengerDistance,
);
response.passengerDuration = Math.round(
entity.getProps().passengerDuration,
);
response.driverDistance = entity.getProps().driverDistance
? Math.round(entity.getProps().driverDistance as number)
: undefined;
response.driverDuration = entity.getProps().driverDuration
? Math.round(entity.getProps().driverDuration as number)
: undefined;
response.passengerDistance = entity.getProps().passengerDistance
? Math.round(entity.getProps().passengerDistance as number)
: undefined;
response.passengerDuration = entity.getProps().passengerDuration
? Math.round(entity.getProps().passengerDuration as number)
: undefined;
response.fwdAzimuth = Math.round(entity.getProps().fwdAzimuth);
response.backAzimuth = Math.round(entity.getProps().backAzimuth);
response.distanceAzimuth = Math.round(entity.getProps().distanceAzimuth);