-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7156fb4
commit 9756daf
Showing
19 changed files
with
502 additions
and
348 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
class RideMapper { | ||
static entityToDto(ride) { | ||
if(!ride){ | ||
return null; | ||
} | ||
return { | ||
"client": ride.client, | ||
"pickupTimeAndDateInUTC": new Date(ride.pickupTimeAndDateInUTC), | ||
"locationFrom": { | ||
"latitude": ride.locationFrom.x, | ||
"longitude": ride.locationFrom.y, | ||
"suburb": ride.suburbFrom, | ||
"postcode": ride.postCodeFrom, | ||
"placeName": ride.placeNameFrom | ||
}, | ||
"locationTo": { | ||
"latitude": ride.locationTo.x, | ||
"longitude": ride.locationTo.y, | ||
"suburb": ride.suburbTo, | ||
"postcode": ride.postCodeTo, | ||
"placeName": ride.placeNameTo | ||
}, | ||
"fbLink": ride.fbLink, | ||
"driverGender": ride.driverGender, | ||
"carType": ride.carType, | ||
"status": ride.status, | ||
"deleted": parseInt(ride.deleted + ''), | ||
"facilitatorId": ride.facilitatorId || ride.facilitatorEmail, | ||
"description": ride.description, | ||
"id": ride.id | ||
} | ||
} | ||
|
||
static dtoToEntity(ride, facilitatorId) { | ||
if(!ride){ | ||
return null; | ||
} | ||
return { | ||
client: `${ride.client}`, | ||
pickupTimeAndDateInUTC: new Date(ride.pickupTimeAndDateInUTC), | ||
locationFrom: { | ||
latitude: ride.locationFrom.latitude, | ||
longitude: ride.locationFrom.longitude, | ||
suburb: ride.locationFrom.suburb, | ||
placeName: ride.locationFrom.placeName, | ||
postcode: ride.locationFrom.postcode, | ||
}, | ||
locationTo: { | ||
latitude: ride.locationTo.latitude, | ||
longitude: ride.locationTo.longitude, | ||
suburb: ride.locationTo.suburb, | ||
placeName: ride.locationTo.placeName, | ||
postcode: ride.locationTo.postcode, | ||
}, | ||
fbLink: ride.fbLink, | ||
driverGender: ride.driverGender, | ||
carType: ride.carType, | ||
status: ride.status, | ||
deleted: 0, | ||
facilitatorId: facilitatorId, | ||
description: ride.description | ||
} | ||
} | ||
} | ||
|
||
module.exports = RideMapper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
class RideStatus { | ||
constructor(status) { | ||
this.statusName = status; | ||
} | ||
|
||
static get OPEN(){ return new RideStatus('OPEN'); } | ||
static get CONFIRMED(){ return new RideStatus('CONFIRMED'); } | ||
static get ENDED(){ return new RideStatus('ENDED'); } | ||
static get CANCELLED(){ return new RideStatus('CANCELLED'); } | ||
} | ||
const RideStatus = { | ||
OPEN: 'OPEN', | ||
CONFIRMED: 'CONFIRMED', | ||
ENDED: 'ENDED', | ||
CANCELLED: 'CANCELLED', | ||
}; | ||
|
||
module.exports = RideStatus; |
Oops, something went wrong.