34 lines
841 B
JavaScript
34 lines
841 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, options) => {
|
|
const myOptions = {};
|
|
|
|
if (typeof options == 'object')
|
|
Object.assign(myOptions, options);
|
|
|
|
const query = `SELECT vn.clientGetMana(?) AS mana`;
|
|
const [mana] = await Self.rawSql(query, [clientFk], myOptions);
|
|
|
|
return mana;
|
|
};
|
|
};
|