mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Support unpinning Post
This commit is contained in:
parent
dd55d11739
commit
36f6be9e36
@ -113,9 +113,10 @@ export default {
|
||||
return post
|
||||
},
|
||||
UpdatePost: async (_parent, params, context, _resolveInfo) => {
|
||||
const { categoryIds, pinned } = params
|
||||
const { categoryIds, pinned, unpinned } = params
|
||||
const { id: userId } = context.user
|
||||
delete params.pinned
|
||||
delete params.unpinned
|
||||
delete params.categoryIds
|
||||
params = await fileUpload(params, { file: 'imageUpload', url: 'image' })
|
||||
const session = context.driver.session()
|
||||
@ -142,6 +143,16 @@ export default {
|
||||
`
|
||||
}
|
||||
|
||||
if (unpinned) {
|
||||
const cypherRemovePinnedStatus = `
|
||||
MATCH ()-[previousRelations:PINNED]->(post:Post {id: $params.id})
|
||||
DELETE previousRelations
|
||||
RETURN post
|
||||
`
|
||||
|
||||
await session.run(cypherRemovePinnedStatus, { params })
|
||||
}
|
||||
|
||||
if (pinned) {
|
||||
const cypherDeletePreviousRelations = `
|
||||
MATCH ()-[previousRelations:PINNED]->(post:Post)
|
||||
|
||||
@ -85,6 +85,7 @@ type Mutation {
|
||||
language: String
|
||||
categoryIds: [ID]
|
||||
pinned: Boolean
|
||||
unpinned: Boolean
|
||||
): Post
|
||||
DeletePost(id: ID!): Post
|
||||
AddPostEmotions(to: _PostInput!, data: _EMOTEDInput!): EMOTED
|
||||
|
||||
@ -121,6 +121,7 @@ input _UserFilter {
|
||||
followedBy_none: _UserFilter
|
||||
followedBy_single: _UserFilter
|
||||
followedBy_every: _UserFilter
|
||||
role_in: [UserGroup!]
|
||||
}
|
||||
|
||||
type Query {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user