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 }
|
const updatePostVariables = { categoryIds, params }
|
||||||
try {
|
try {
|
||||||
const writeTxResultPromise = session.writeTransaction(async (transaction) => {
|
const writeTxResultPromise = session.writeTransaction(async (transaction) => {
|
||||||
|
|||||||
@ -354,6 +354,7 @@ describe('UpdatePost', () => {
|
|||||||
$content: String!
|
$content: String!
|
||||||
$image: ImageInput
|
$image: ImageInput
|
||||||
$categoryIds: [ID]
|
$categoryIds: [ID]
|
||||||
|
$postType: PostType
|
||||||
) {
|
) {
|
||||||
UpdatePost(
|
UpdatePost(
|
||||||
id: $id
|
id: $id
|
||||||
@ -361,6 +362,7 @@ describe('UpdatePost', () => {
|
|||||||
content: $content
|
content: $content
|
||||||
image: $image
|
image: $image
|
||||||
categoryIds: $categoryIds
|
categoryIds: $categoryIds
|
||||||
|
postType: $postType
|
||||||
) {
|
) {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
@ -374,6 +376,7 @@ describe('UpdatePost', () => {
|
|||||||
categories {
|
categories {
|
||||||
id
|
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.skip('params.image', () => {
|
||||||
describe('is object', () => {
|
describe('is object', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user