feat: refs #7882 Added osrmservice #3281

Merged
guillermo merged 16 commits from 7882-locationiq into dev 2024-12-16 06:58:54 +00:00
3 changed files with 14 additions and 14 deletions
Showing only changes of commit 65e195d77d - Show all commits

View File

@ -32,12 +32,12 @@ module.exports = Self => {
let coords = [];
if (firstAddressId) {
const firstAddress = await models.Address.findById(firstAddressId);
if (firstAddress.latitude && firstAddress.longitude) {
const address = await models.Address.findById(firstAddressId);
if (address.latitude && address.longitude) {
coords.push({
addressId: firstAddress.id,
latitude: firstAddress.latitude.toFixed(6),
longitude: firstAddress.longitude.toFixed(6)
addressId: address.id,
latitude: address.latitude.toFixed(6),
longitude: address.longitude.toFixed(6)
});
}
}
@ -73,7 +73,7 @@ module.exports = Self => {
${osrmConfig.url}/trip/v1/driving/${concatCoords}?source=first&destination=last&roundtrip=true
`);
const tolerance = osrmConfig.tolerance;
for (waypoint of response.data.waypoints) {
for (const waypoint of response.data.waypoints) {
const longitude = waypoint.location[0];
const latitude = waypoint.location[1];

View File

@ -75,11 +75,11 @@ module.exports = function(Self) {
},
{
arg: 'longitude',
type: 'number',
type: 'any',
},
{
arg: 'latitude',
type: 'number',
type: 'any',
}
],
returns: {

View File

@ -28,17 +28,17 @@ module.exports = Self => {
if (typeof options == 'object')
Object.assign(myOptions, options);
const ticketsIds = await models.Ticket.find({
const tickets = await models.Ticket.find({
where: {routeFk: id}
}, myOptions);
let ticketAddress = [];
for (const ticketId of ticketsIds) {
for (const ticket of tickets) {
ticketAddress.push({
ticketId: ticketId.id,
addressId: ticketId.addressFk,
zoneId: ticketId.zoneFk,
priority: ticketId.priority
ticketId: ticket.id,
addressId: ticket.addressFk,
zoneId: ticket.zoneFk,
priority: ticket.priority
});
}