Vulcan/packages/nova-posts/lib/collection.js

42 lines
916 B
JavaScript
Raw Normal View History

2016-12-13 11:32:23 +09:00
import schema from './schema.js';
import mutations from './mutations.js';
import resolvers from './resolvers.js';
// import views from './views.js';
import { createCollection } from 'meteor/nova:core';
2016-06-23 12:17:39 +09:00
/**
* @summary The global namespace for Posts.
* @namespace Posts
*/
const Posts = createCollection({
2016-06-23 12:17:39 +09:00
collectionName: 'posts',
2016-06-23 12:17:39 +09:00
typeName: 'Post',
schema,
resolvers,
mutations,
});
// refacto: moved here from schema.js
Posts.config = {};
Posts.config.STATUS_PENDING = 1;
Posts.config.STATUS_APPROVED = 2;
Posts.config.STATUS_REJECTED = 3;
Posts.config.STATUS_SPAM = 4;
Posts.config.STATUS_DELETED = 5;
export default Posts;
// const PostsStub = {
// helpers: x => x
// }
// we need to handle two scenarios: when the package is called as a Meteor package,
// and when it's called as a NPM package
// const Posts = typeof Mongo !== 'undefined' ? new Mongo.Collection('posts') : PostsStub;