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

29 lines
697 B
JavaScript

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;
};
};