mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
update posts with post type parameter
This commit is contained in:
parent
2c52d08a94
commit
f00b36b99e
@ -184,7 +184,16 @@ export default {
|
||||
`
|
||||
}
|
||||
|
||||
updatePostCypher += `RETURN post {.*}`
|
||||
if (params.postType) {
|
||||
updatePostCypher += `
|
||||
REMOVE post:Article
|
||||
REMOVE post:Event
|
||||
SET post:${params.postType}
|
||||
WITH post
|
||||
`
|
||||
}
|
||||
|
||||
updatePostCypher += `RETURN post {.*, postType: filter(l IN labels(post) WHERE NOT l = "Post")}`
|
||||
const updatePostVariables = { categoryIds, params }
|
||||
try {
|
||||
const writeTxResultPromise = session.writeTransaction(async (transaction) => {
|
||||
|
||||
@ -354,6 +354,7 @@ describe('UpdatePost', () => {
|
||||
$content: String!
|
||||
$image: ImageInput
|
||||
$categoryIds: [ID]
|
||||
$postType: PostType
|
||||
) {
|
||||
UpdatePost(
|
||||
id: $id
|
||||
@ -361,6 +362,7 @@ describe('UpdatePost', () => {
|
||||
content: $content
|
||||
image: $image
|
||||
categoryIds: $categoryIds
|
||||
postType: $postType
|
||||
) {
|
||||
id
|
||||
title
|
||||
@ -374,6 +376,7 @@ describe('UpdatePost', () => {
|
||||
categories {
|
||||
id
|
||||
}
|
||||
postType
|
||||
}
|
||||
}
|
||||
`
|
||||
@ -495,6 +498,22 @@ describe('UpdatePost', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('post type', () => {
|
||||
it.only('changes the post type', async () => {
|
||||
await expect(
|
||||
mutate({ mutation: updatePostMutation, variables: { ...variables, postType: 'Event' } }),
|
||||
).resolves.toMatchObject({
|
||||
data: {
|
||||
UpdatePost: {
|
||||
id: newlyCreatedPost.id,
|
||||
postType: ['Event'],
|
||||
},
|
||||
},
|
||||
errors: undefined,
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe.skip('params.image', () => {
|
||||
describe('is object', () => {
|
||||
beforeEach(() => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user