mirror of
https://github.com/vale981/Vulcan
synced 2025-03-08 19:11:38 -05:00
179 lines
2.9 KiB
JavaScript
179 lines
2.9 KiB
JavaScript
import { registerFragment, getFragment } from 'meteor/vulcan:core';
|
|
|
|
// ------------------------------ Vote ------------------------------ //
|
|
|
|
// note: fragment used by default on the UsersProfile fragment
|
|
registerFragment(`
|
|
fragment VotedItem on Vote {
|
|
# vulcan:voting
|
|
itemId
|
|
power
|
|
votedAt
|
|
}
|
|
`);
|
|
|
|
// ------------------------------ Users ------------------------------ //
|
|
|
|
// note: fragment used by default on UsersProfile, PostsList & CommentsList fragments
|
|
registerFragment(`
|
|
fragment UsersMinimumInfo on User {
|
|
# vulcan:users
|
|
_id
|
|
slug
|
|
username
|
|
displayName
|
|
emailHash
|
|
}
|
|
`);
|
|
|
|
registerFragment(`
|
|
fragment UsersProfile on User {
|
|
# vulcan:users
|
|
...UsersMinimumInfo
|
|
createdAt
|
|
isAdmin
|
|
bio
|
|
htmlBio
|
|
twitterUsername
|
|
website
|
|
groups
|
|
karma
|
|
# vulcan:posts
|
|
postCount
|
|
# vulcan:comments
|
|
commentCount
|
|
# vulcan:voting
|
|
downvotedComments {
|
|
...VotedItem
|
|
}
|
|
downvotedPosts {
|
|
...VotedItem
|
|
}
|
|
upvotedComments {
|
|
...VotedItem
|
|
}
|
|
upvotedPosts {
|
|
...VotedItem
|
|
}
|
|
}
|
|
`);
|
|
|
|
// ------------------------------ Categories ------------------------------ //
|
|
|
|
// note: fragment used by default on CategoriesList & PostsList fragments
|
|
registerFragment(`
|
|
fragment CategoriesMinimumInfo on Category {
|
|
# vulcan:categories
|
|
_id
|
|
name
|
|
slug
|
|
}
|
|
`);
|
|
|
|
registerFragment(`
|
|
fragment CategoriesList on Category {
|
|
# vulcan:categories
|
|
...CategoriesMinimumInfo
|
|
description
|
|
order
|
|
image
|
|
parentId
|
|
parent {
|
|
...CategoriesMinimumInfo
|
|
}
|
|
}
|
|
`);
|
|
|
|
// ------------------------------ Posts ------------------------------ //
|
|
|
|
registerFragment(`
|
|
fragment PostsList on Post {
|
|
# vulcan:posts
|
|
_id
|
|
title
|
|
url
|
|
slug
|
|
postedAt
|
|
createdAt
|
|
sticky
|
|
status
|
|
body
|
|
htmlBody
|
|
excerpt
|
|
viewCount
|
|
clickCount
|
|
# vulcan:users
|
|
userId
|
|
user {
|
|
...UsersMinimumInfo
|
|
}
|
|
# vulcan:embedly
|
|
thumbnailUrl
|
|
# vulcan:categories
|
|
categories {
|
|
...CategoriesMinimumInfo
|
|
}
|
|
# vulcan:comments
|
|
commentCount
|
|
commenters {
|
|
...UsersMinimumInfo
|
|
}
|
|
# vulcan:voting
|
|
upvoters {
|
|
_id
|
|
}
|
|
downvoters {
|
|
_id
|
|
}
|
|
upvotes
|
|
downvotes
|
|
baseScore
|
|
score
|
|
}
|
|
`);
|
|
|
|
registerFragment(`
|
|
fragment PostsPage on Post {
|
|
...PostsList
|
|
}
|
|
`);
|
|
|
|
|
|
// ----------------------------- Comments ------------------------------ //
|
|
|
|
registerFragment(`
|
|
fragment CommentsList on Comment {
|
|
# vulcan:comments
|
|
_id
|
|
postId
|
|
parentCommentId
|
|
topLevelCommentId
|
|
body
|
|
htmlBody
|
|
postedAt
|
|
# vulcan:users
|
|
userId
|
|
user {
|
|
...UsersMinimumInfo
|
|
}
|
|
# vulcan:posts
|
|
post {
|
|
_id
|
|
commentCount
|
|
commenters {
|
|
...UsersMinimumInfo
|
|
}
|
|
}
|
|
# vulcan:voting
|
|
upvoters {
|
|
_id
|
|
}
|
|
downvoters {
|
|
_id
|
|
}
|
|
upvotes
|
|
downvotes
|
|
baseScore
|
|
score
|
|
}
|
|
`);
|