mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
84 lines
1.8 KiB
JavaScript
84 lines
1.8 KiB
JavaScript
import gql from 'graphql-tag'
|
|
import { postFragment, commentFragment, postCountsFragment } from './Fragments'
|
|
|
|
export default i18n => {
|
|
const lang = i18n.locale().toUpperCase()
|
|
return gql`
|
|
${postFragment(lang)}
|
|
${postCountsFragment}
|
|
${commentFragment(lang)}
|
|
|
|
query Post($id: ID!) {
|
|
Post(id: $id) {
|
|
...post
|
|
...postCounts
|
|
comments(orderBy: createdAt_asc) {
|
|
...comment
|
|
}
|
|
}
|
|
}
|
|
`
|
|
}
|
|
|
|
export const filterPosts = i18n => {
|
|
const lang = i18n.locale().toUpperCase()
|
|
return gql`
|
|
${postFragment(lang)}
|
|
${postCountsFragment}
|
|
|
|
query Post($filter: _PostFilter, $first: Int, $offset: Int, $orderBy: [_PostOrdering]) {
|
|
Post(filter: $filter, first: $first, offset: $offset, orderBy: $orderBy) {
|
|
...post
|
|
...postCounts
|
|
}
|
|
}
|
|
`
|
|
}
|
|
|
|
export const profilePagePosts = i18n => {
|
|
const lang = i18n.locale().toUpperCase()
|
|
return gql`
|
|
${postFragment(lang)}
|
|
${postCountsFragment}
|
|
|
|
query profilePagePosts(
|
|
$filter: _PostFilter
|
|
$first: Int
|
|
$offset: Int
|
|
$orderBy: [_PostOrdering]
|
|
) {
|
|
profilePagePosts(filter: $filter, first: $first, offset: $offset, orderBy: $orderBy) {
|
|
...post
|
|
...postCounts
|
|
}
|
|
}
|
|
`
|
|
}
|
|
|
|
export const PostsEmotionsByCurrentUser = () => {
|
|
return gql`
|
|
query PostsEmotionsByCurrentUser($postId: ID!) {
|
|
PostsEmotionsByCurrentUser(postId: $postId)
|
|
}
|
|
`
|
|
}
|
|
|
|
export const relatedContributions = i18n => {
|
|
const lang = i18n.locale().toUpperCase()
|
|
return gql`
|
|
${postFragment(lang)}
|
|
${postCountsFragment}
|
|
|
|
query Post($slug: String!) {
|
|
Post(slug: $slug) {
|
|
...post
|
|
...postCounts
|
|
relatedContributions(first: 2) {
|
|
...post
|
|
...postCounts
|
|
}
|
|
}
|
|
}
|
|
`
|
|
}
|