salix/modules/travel/back/models/travel.js

22 lines
888 B
JavaScript

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/createThermograph')(Self);
require('../methods/travel/deleteThermograph')(Self);
require('../methods/travel/updateThermograph')(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;
});
};