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

97 lines
1.5 KiB
JavaScript
Raw Normal View History

2016-11-08 15:04:17 +09:00
import Telescope from 'meteor/nova:lib';
import Posts from './collection.js';
Telescope.graphQL.addQuery(`
posts(terms: Terms, offset: Int, limit: Int): [Post]
postsViewTotal(terms: Terms): Int
post(_id: String): Post
`);
Posts.graphQLQueries = {
list: `
_id
title
url
slug
thumbnailUrl
baseScore
postedAt
sticky
categories {
_id
name
slug
}
commentCount
commenters {
_id
telescope {
displayName
emailHash
slug
}
}
upvoters {
_id
}
downvoters {
_id
}
upvotes # should be asked only for admins?
score # should be asked only for admins?
viewCount # should be asked only for admins?
clickCount # should be asked only for admins?
user {
_id
telescope {
displayName
slug
emailHash
}
}
`,
single: `
_id
title
url
slug
body
htmlBody
thumbnailUrl
baseScore
postedAt
sticky
status
categories {
_id
name
slug
}
commentCount
commenters {
_id
telescope {
slug
emailHash
}
}
upvoters {
_id
}
downvoters {
_id
}
upvotes # should be asked only for admins?
score # should be asked only for admins?
viewCount # should be asked only for admins?
clickCount # should be asked only for admins?
user {
_id
telescope {
displayName
slug
emailHash
}
}
`
};