Ocelot-Social/webapp/graphql/PostMutations.js
mattwr18 be0c8044e8 Return pinnedAt date from pinPost resolver/clean up
- it's good to return the pinnedAt date for ordering
- move test to a better describe block
- remove unneeded outdated variables from graphql/PostQuery UpdatePost
- fix indentation in Post.gql
- fix pinnedAt to return pinned.createdAt, not post.createdAt

Co-authored-by: Mike Aono <aonomike@gmail.com>
2019-10-18 15:10:26 +02:00

130 lines
2.4 KiB
JavaScript

import gql from 'graphql-tag'
export default () => {
return {
CreatePost: gql`
mutation(
$title: String!
$content: String!
$language: String
$categoryIds: [ID]
$imageUpload: Upload
) {
CreatePost(
title: $title
content: $content
language: $language
categoryIds: $categoryIds
imageUpload: $imageUpload
) {
title
slug
content
contentExcerpt
language
}
}
`,
UpdatePost: gql`
mutation(
$id: ID!
$title: String!
$content: String!
$language: String
$imageUpload: Upload
$categoryIds: [ID]
$image: String
) {
UpdatePost(
id: $id
title: $title
content: $content
language: $language
imageUpload: $imageUpload
categoryIds: $categoryIds
image: $image
) {
id
title
slug
content
contentExcerpt
language
pinnedBy {
id
name
role
}
}
}
`,
DeletePost: gql`
mutation($id: ID!) {
DeletePost(id: $id) {
id
}
}
`,
AddPostEmotionsMutation: gql`
mutation($to: _PostInput!, $data: _EMOTEDInput!) {
AddPostEmotions(to: $to, data: $data) {
emotion
from {
id
}
to {
id
}
}
}
`,
RemovePostEmotionsMutation: gql`
mutation($to: _PostInput!, $data: _EMOTEDInput!) {
RemovePostEmotions(to: $to, data: $data) {
emotion
from {
id
}
to {
id
}
}
}
`,
pinPost: gql`
mutation($id: ID!) {
pinPost(id: $id) {
id
title
slug
content
contentExcerpt
language
pinnedBy {
id
name
role
}
}
}
`,
unpinPost: gql`
mutation($id: ID!) {
unpinPost(id: $id) {
id
title
slug
content
contentExcerpt
language
pinnedBy {
id
name
role
}
}
}
`,
}
}