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