Merge branch 'master' into 195937-icoterms
gitea/salix/pipeline/pr-master This commit looks good
Details
gitea/salix/pipeline/pr-master This commit looks good
Details
This commit is contained in:
commit
72fd806750
|
@ -20,21 +20,4 @@ module.exports = Self => {
|
||||||
require('../methods/route/cmrEmail')(Self);
|
require('../methods/route/cmrEmail')(Self);
|
||||||
require('../methods/route/getExpeditionSummary')(Self);
|
require('../methods/route/getExpeditionSummary')(Self);
|
||||||
require('../methods/route/getByWorker')(Self);
|
require('../methods/route/getByWorker')(Self);
|
||||||
|
|
||||||
Self.validate('kmStart', validateDistance, {
|
|
||||||
message: 'Distance must be lesser than 4000'
|
|
||||||
});
|
|
||||||
|
|
||||||
Self.validate('kmEnd', validateDistance, {
|
|
||||||
message: 'Distance must be lesser than 4000'
|
|
||||||
});
|
|
||||||
|
|
||||||
function validateDistance(err) {
|
|
||||||
if (this.kmEnd) {
|
|
||||||
const routeTotalKm = this.kmEnd - this.kmStart;
|
|
||||||
const routeMaxKm = 4000;
|
|
||||||
if (routeTotalKm > routeMaxKm || this.kmStart > this.kmEnd)
|
|
||||||
err();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue