46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
module.exports = Self => {
|
|
Self.remoteMethod('docuwareDownload', {
|
|
description: 'Download a worker document',
|
|
accessType: 'READ',
|
|
accepts: [
|
|
{
|
|
arg: 'id',
|
|
type: 'Number',
|
|
description: 'The document id',
|
|
http: {source: 'path'}
|
|
}
|
|
],
|
|
returns: [
|
|
{
|
|
arg: 'body',
|
|
type: 'file',
|
|
root: true
|
|
}, {
|
|
arg: 'Content-Type',
|
|
type: 'String',
|
|
http: {target: 'header'}
|
|
}, {
|
|
arg: 'Content-Disposition',
|
|
type: 'String',
|
|
http: {target: 'header'}
|
|
}
|
|
],
|
|
http: {
|
|
path: `/:id/docuwareDownload`,
|
|
verb: 'GET'
|
|
}
|
|
});
|
|
|
|
Self.docuwareDownload = async id => {
|
|
const filter = {
|
|
condition: [
|
|
{
|
|
DBName: 'FILENAME',
|
|
Value: [id]
|
|
}
|
|
]
|
|
};
|
|
return Self.app.models.Docuware.download(id, 'hr', filter);
|
|
};
|
|
};
|