Ocelot-Social/webapp/graphql/PostMutations.js
Robert Schäfer 512ef672bf
feat: Introduce graphql image type (#3043)
* refactor(graphql): Introduce image type

* Undo changes to .travis.yml

* chore: Upgrade travis to node LTS

- URL is available since v10

* chore: use lts

Co-authored-by: mattwr18 <mattwr18@gmail.com>
2020-03-16 15:32:19 +01:00

135 lines
2.4 KiB
JavaScript

import gql from 'graphql-tag'
export default () => {
return {
CreatePost: gql`
mutation(
$title: String!
$content: String!
$language: String
$categoryIds: [ID]
$image: ImageInput
) {
CreatePost(
title: $title
content: $content
language: $language
categoryIds: $categoryIds
image: $image
) {
title
slug
content
contentExcerpt
language
image {
sensitive
}
}
}
`,
UpdatePost: gql`
mutation(
$id: ID!
$title: String!
$content: String!
$language: String
$image: ImageInput
$categoryIds: [ID]
) {
UpdatePost(
id: $id
title: $title
content: $content
language: $language
image: $image
categoryIds: $categoryIds
) {
id
title
slug
content
contentExcerpt
language
image {
sensitive
aspectRatio
}
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
}
}
}
`,
}
}