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-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
|
|
|
};
|