grapher/lib/namedQuery/testing/bootstrap/server.js

49 lines
988 B
JavaScript
Raw Normal View History

2017-11-26 19:15:00 +02:00
import { createQuery, MemoryResultCacher } from 'meteor/cultofcoders:grapher';
import postListExposure from './queries/postListExposure.js';
2017-11-23 21:02:00 +02:00
const postList = createQuery('postList', {
posts: {
2017-11-26 20:18:30 +02:00
$filter({filters, options, params}) {
if (params.title) {
filters.title = params.title;
}
if (params.limit) {
options.limit = params.limit;
}
},
title: 1,
author: {
name: 1
},
group: {
name: 1
}
}
});
2017-11-26 19:15:00 +02:00
export { postList };
export { postListExposure };
postListExposure.expose({
firewall(userId, params) {
},
embody: {
$filter({filters, params}) {
filters.title = params.title
}
}
});
2017-11-26 19:15:00 +02:00
const postListCached = createQuery('postListCached', {
posts: {
title: 1,
}
});
export {postListCached};
postListCached.cacheResults(new MemoryResultCacher({
ttl: 200,
2017-11-26 19:15:00 +02:00
}));