mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-01-20 20:01:25 +00:00
* remove dead code (passport-jwt) * refactor resolves to have a separate folder * currentUser and login have the same response
23 lines
564 B
JavaScript
23 lines
564 B
JavaScript
import { neo4jgraphql } from 'neo4j-graphql-js'
|
|
|
|
export default {
|
|
Mutation: {
|
|
CreatePost: async (object, params, ctx, resolveInfo) => {
|
|
const result = await neo4jgraphql(object, params, ctx, resolveInfo, false)
|
|
|
|
const session = ctx.driver.session()
|
|
await session.run(
|
|
'MATCH (author:User {id: $userId}), (post:Post {id: $postId}) ' +
|
|
'MERGE (post)<-[:WROTE]-(author) ' +
|
|
'RETURN author', {
|
|
userId: ctx.user.id,
|
|
postId: result.id
|
|
})
|
|
session.close()
|
|
|
|
return result
|
|
}
|
|
|
|
}
|
|
}
|