2020-03-10 13:09:26 +00:00
|
|
|
const UserError = require('vn-loopback/util/user-error');
|
|
|
|
|
2019-10-24 10:49:18 +00:00
|
|
|
module.exports = Self => {
|
|
|
|
require('../methods/travel/getTravel')(Self);
|
|
|
|
require('../methods/travel/getEntries')(Self);
|
2019-12-20 06:55:00 +00:00
|
|
|
require('../methods/travel/filter')(Self);
|
2020-01-21 11:21:53 +00:00
|
|
|
require('../methods/travel/deleteThermograph')(Self);
|
2024-09-25 11:23:31 +00:00
|
|
|
require('../methods/travel/saveThermograph')(Self);
|
2020-11-13 08:30:40 +00:00
|
|
|
require('../methods/travel/extraCommunityFilter')(Self);
|
2021-02-12 10:27:24 +00:00
|
|
|
require('../methods/travel/getAverageDays')(Self);
|
2020-12-28 13:53:26 +00:00
|
|
|
require('../methods/travel/cloneWithEntries')(Self);
|
2022-09-26 11:33:27 +00:00
|
|
|
require('../methods/travel/extraCommunityPdf')(Self);
|
|
|
|
require('../methods/travel/extraCommunityEmail')(Self);
|
2020-03-10 13:09:26 +00:00
|
|
|
|
|
|
|
Self.rewriteDbError(function(err) {
|
|
|
|
if (err.code === 'ER_DUP_ENTRY')
|
2020-03-11 11:03:55 +00:00
|
|
|
return new UserError('A travel with this data already exists');
|
2020-03-10 13:09:26 +00:00
|
|
|
return err;
|
|
|
|
});
|
2019-10-24 10:49:18 +00:00
|
|
|
};
|