14 lines
482 B
JavaScript
14 lines
482 B
JavaScript
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;
|
|
});
|
|
};
|