2019-03-22 10:10:23 +00:00
|
|
|
module.exports = Self => {
|
2019-04-25 06:28:08 +00:00
|
|
|
require('../methods/route/filter')(Self);
|
2019-03-22 10:10:23 +00:00
|
|
|
require('../methods/route/summary')(Self);
|
2019-03-25 12:16:34 +00:00
|
|
|
require('../methods/route/getTickets')(Self);
|
2019-04-04 11:06:41 +00:00
|
|
|
require('../methods/route/guessPriority')(Self);
|
2019-06-05 11:51:34 +00:00
|
|
|
require('../methods/route/updateVolume')(Self);
|
2019-12-10 11:42:14 +00:00
|
|
|
require('../methods/route/getDeliveryPoint')(Self);
|
2020-12-21 13:48:47 +00:00
|
|
|
require('../methods/route/insertTicket')(Self);
|
2020-12-24 10:31:20 +00:00
|
|
|
require('../methods/route/clone')(Self);
|
2021-03-15 10:32:17 +00:00
|
|
|
require('../methods/route/getSuggestedTickets')(Self);
|
2022-02-23 15:12:29 +00:00
|
|
|
require('../methods/route/unlink')(Self);
|
2022-07-05 08:19:06 +00:00
|
|
|
require('../methods/route/updateWorkCenter')(Self);
|
2020-02-18 11:51:29 +00:00
|
|
|
|
|
|
|
Self.validate('kmStart', validateDistance, {
|
|
|
|
message: 'Distance must be lesser than 1000'
|
|
|
|
});
|
|
|
|
|
|
|
|
Self.validate('kmEnd', validateDistance, {
|
|
|
|
message: 'Distance must be lesser than 1000'
|
|
|
|
});
|
|
|
|
|
|
|
|
function validateDistance(err) {
|
|
|
|
const routeTotalKm = this.kmEnd - this.kmStart;
|
|
|
|
const routeMaxKm = 1000;
|
2020-11-20 11:12:06 +00:00
|
|
|
if (routeTotalKm > routeMaxKm || this.kmStart > this.kmEnd)
|
2020-02-18 11:51:29 +00:00
|
|
|
err();
|
|
|
|
}
|
2019-03-22 10:10:23 +00:00
|
|
|
};
|