module.exports = Self => { require('../methods/route/filter')(Self); require('../methods/route/summary')(Self); require('../methods/route/getTickets')(Self); require('../methods/route/guessPriority')(Self); require('../methods/route/updateVolume')(Self); require('../methods/route/getDeliveryPoint')(Self); require('../methods/route/insertTicket')(Self); require('../methods/route/clone')(Self); require('../methods/route/getSuggestedTickets')(Self); require('../methods/route/unlink')(Self); require('../methods/route/updateWorkCenter')(Self); require('../methods/route/driverRoutePdf')(Self); require('../methods/route/driverRouteEmail')(Self); 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; if (routeTotalKm > routeMaxKm || this.kmStart > this.kmEnd) err(); } };