Ocelot-Social/webapp/graphql/PostMutations.js
Ulf Gebhardt e87a33eb3f
feat(backend): push posts (#8609)
* push posts

push posts

* unpush posts

* fix comment query

* locales

* fix locales

* fix tests

* Update webapp/locales/de.json

Co-authored-by: Wolfgang Huß <wolle.huss@pjannto.com>

* Update webapp/locales/de.json

Co-authored-by: Wolfgang Huß <wolle.huss@pjannto.com>

* Update webapp/locales/de.json

Co-authored-by: Wolfgang Huß <wolle.huss@pjannto.com>

* fix unpushedSuccessfully english message

* remove paremeters from unpushPost

* rename pushPostToTop -> pushPost, tests

* update locales & tests webapp

* fix lint

---------

Co-authored-by: Wolfgang Huß <wolle.huss@pjannto.com>
2025-06-03 17:57:21 +02:00

222 lines
4.1 KiB
JavaScript

import gql from 'graphql-tag'
export default () => {
return {
CreatePost: gql`
mutation (
$id: ID
$title: String!
$slug: String
$content: String!
$categoryIds: [ID]
$image: ImageInput
$groupId: ID
$postType: PostType
$eventInput: _EventInput
) {
CreatePost(
id: $id
title: $title
slug: $slug
content: $content
categoryIds: $categoryIds
image: $image
groupId: $groupId
postType: $postType
eventInput: $eventInput
) {
id
slug
title
content
contentExcerpt
language
image {
url
sensitive
}
disabled
deleted
postType
author {
id
name
}
categories {
id
}
eventStart
eventVenue
eventLocationName
eventLocation {
lng
lat
}
}
}
`,
UpdatePost: gql`
mutation (
$id: ID!
$title: String!
$content: String!
$image: ImageInput
$categoryIds: [ID]
$postType: PostType
$eventInput: _EventInput
) {
UpdatePost(
id: $id
title: $title
content: $content
image: $image
categoryIds: $categoryIds
postType: $postType
eventInput: $eventInput
) {
id
title
slug
content
contentExcerpt
language
image {
url
sensitive
aspectRatio
}
pinnedBy {
id
name
role
}
postType
eventStart
eventLocationName
eventVenue
eventLocation {
lng
lat
}
}
}
`,
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
}
}
}
`,
pushPost: gql`
mutation ($id: ID!) {
pushPost(id: $id) {
id
title
slug
content
contentExcerpt
language
pinnedBy {
id
name
role
}
}
}
`,
unpushPost: gql`
mutation ($id: ID!) {
unpushPost(id: $id) {
id
title
slug
content
contentExcerpt
language
pinnedBy {
id
name
role
}
}
}
`,
markTeaserAsViewed: gql`
mutation ($id: ID!) {
markTeaserAsViewed(id: $id) {
id
}
}
`,
toggleObservePost: gql`
mutation ($id: ID!, $value: Boolean!) {
toggleObservePost(id: $id, value: $value) {
isObservedByMe
observingUsersCount
}
}
`,
}
}