@trusthab/composable-resources
Version:
migrating https://github.com/knetikmedia/hab-api/tree/integration/app/resources/composable
35 lines (25 loc) • 606 B
JavaScript
const composer = require('../../mixin_loader');
module.exports = (App) => {
const { underscore } = require('inflected');
class ResidentsActiveResource {
static mixins() {
return ['Kpi'];
}
getMetricId() {
return 'residents_active';
}
getMetricType() {
return 'gauge';
}
getIdentifier() {
const obj = this.get('obj');
return obj.email;
}
getValue() {
const { location_type } = this.get('obj');
if (location_type === 'unit') { return 1; }
return 0;
}
}
return composer(ResidentsActiveResource, App);
};