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/createThermograph')(Self);
|
|
|
|
require('../methods/travel/deleteThermograph')(Self);
|
2020-02-28 13:18:55 +00:00
|
|
|
require('../methods/travel/updateThermograph')(Self);
|
2020-11-13 08:30:40 +00:00
|
|
|
require('../methods/travel/extraCommunityFilter')(Self);
|
2021-02-10 07:47:58 +00:00
|
|
|
require('../methods/travel/getTravelData')(Self);
|
2020-12-28 13:53:26 +00:00
|
|
|
require('../methods/travel/cloneWithEntries')(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
|
|
|
};
|