salix/modules/ticket/back/models/ticket-weekly.js

12 lines
331 B
JavaScript

const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
require('../methods/ticket-weekly/filter')(Self);
Self.rewriteDbError(function(err) {
if (err.code === 'ER_DUP_ENTRY')
return new UserError(`This ticket is already on weekly tickets`);
return err;
});
};