salix/services/loopback/common/methods/client/getMana.js

29 lines
697 B
JavaScript
Raw Normal View History

2018-03-27 13:06:22 +00:00
module.exports = Self => {
Self.remoteMethod('getMana', {
description: 'Returns the boolean mana of a client',
accessType: 'READ',
accepts: [{
arg: 'id',
type: 'number',
required: true,
description: 'client id',
http: {source: 'path'}
}],
returns: {
type: 'number',
root: true
},
http: {
path: `/:id/getMana`,
verb: 'GET'
}
});
Self.getMana = async clientFk => {
let query = `SELECT vn.clientGetMana(?) AS mana`;
let [mana] = await Self.rawSql(query, [clientFk]);
return mana;
};
};