const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { require('../methods/travel/getTravel')(Self); require('../methods/travel/getEntries')(Self); require('../methods/travel/filter')(Self); require('../methods/travel/deleteThermograph')(Self); require('../methods/travel/saveThermograph')(Self); require('../methods/travel/extraCommunityFilter')(Self); require('../methods/travel/getAverageDays')(Self); require('../methods/travel/cloneWithEntries')(Self); require('../methods/travel/extraCommunityPdf')(Self); require('../methods/travel/extraCommunityEmail')(Self); Self.rewriteDbError(function(err) { if (err.code === 'ER_DUP_ENTRY') return new UserError('A travel with this data already exists'); return err; }); };