salix/services/loopback/common/models/state.js

20 lines
526 B
JavaScript
Raw Normal View History

module.exports = Self => {
require('../methods/state/list')(Self);
2018-05-08 07:32:30 +00:00
/**
* Checks if the alertLevel of a state is 0.
*
* @param {Integer} stateId The user id
* @return {Boolean} %true if user has the role, %false otherwise
*/
Self.isAlertLevel0 = async function(stateId) {
let result = await Self.rawSql(
`SELECT alertLevel
FROM vn.state
WHERE id = ?`,
[stateId]
);
return result[0].alertLevel == 0;
};
2017-10-11 13:36:47 +00:00
};