salix/modules/supplier/back/models/supplier-dms.js

14 lines
482 B
JavaScript
Raw Normal View History

const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
require('../methods/supplier/supplier-dms/removeFile')(Self);
require('../methods/supplier/supplier-dms/downloadFile')(Self);
require('../methods/supplier/supplier-dms/uploadFile')(Self);
Self.rewriteDbError(function(err) {
if (err.code === 'ER_DUP_ENTRY')
return new UserError(`The file is already attached to another entry`);
return err;
});
};