Skip to content

Instantly share code, notes, and snippets.

@adamrneary
Created August 21, 2015 16:07
Show Gist options
  • Save adamrneary/41f1bb1975cbd1b3b963 to your computer and use it in GitHub Desktop.
Save adamrneary/41f1bb1975cbd1b3b963 to your computer and use it in GitHub Desktop.
var ThriftApi = require('../ThriftApi');
var model = require('./model');
exports.entityMap = ThriftApi.createEntityMapGetter(model);
exports.byId = ThriftApi.createByIdGetter(model);
exports.jobList = [
exports.entityMap,
['thriftApiCache', 'jobTemplate'],
(jobEntityMap, templateEntityMap) => jobEntityMap
.toList()
.map(job => {
return job.set('jobTemplate',
(templateEntityMap && templateEntityMap.get(job.get('jobTemplateId'))) || {}
);
})
];
exports.activeJobList = [
exports.jobList,
list => list
.filter(item => !item.get('completedAt'))
.sortBy(item => (item.get('title') || '').toLowerCase())
];
exports.completedJobList = [
exports.jobList,
list => list
.filter(item => !!item.get('completedAt'))
.sortBy(item => -item.get('completedAt'))
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment