2018-06-04 07:48:32 +00:00
|
|
|
module.exports = Self => {
|
|
|
|
Self.remoteMethod('getDiary', {
|
|
|
|
description: 'Returns the ',
|
|
|
|
accessType: 'READ',
|
|
|
|
accepts: [{
|
2018-07-04 06:50:34 +00:00
|
|
|
arg: 'filter',
|
|
|
|
type: 'Object',
|
|
|
|
required: true,
|
|
|
|
description: 'Filter defining where and paginated data',
|
|
|
|
http: {source: 'query'}
|
2018-06-04 07:48:32 +00:00
|
|
|
}],
|
|
|
|
returns: {
|
2018-07-04 06:50:34 +00:00
|
|
|
type: ['Object'],
|
2018-06-04 07:48:32 +00:00
|
|
|
root: true
|
|
|
|
},
|
|
|
|
http: {
|
|
|
|
path: `/getDiary`,
|
|
|
|
verb: 'GET'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-07-04 06:50:34 +00:00
|
|
|
Self.getDiary = async filter => {
|
|
|
|
let where = filter.where;
|
|
|
|
let [diary] = await Self.rawSql(`CALL vn.itemDiary(?, ?)`, [where.itemFk, where.warehouseFk]);
|
2018-06-04 07:48:32 +00:00
|
|
|
return diary;
|
|
|
|
};
|
|
|
|
};
|