salix/modules/worker/back/methods/worker-dms/docuwareDownload.js

46 lines
1.1 KiB
JavaScript
Raw Normal View History

module.exports = Self => {
2023-07-05 10:09:52 +00:00
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'
}
});
2023-07-05 10:09:52 +00:00
Self.docuwareDownload = async id => {
const filter = {
condition: [
{
DBName: 'FILENAME',
Value: [id]
}
]
};
2023-07-05 10:09:52 +00:00
return Self.app.models.Docuware.download(id, 'hr', filter);
};
};