Introducing the new fully supported GraphQL to Cypher query execution layer for Neo4j. Here we look at the changes in the two implementations and also suggest some ways to migrate over to the new library. When using the new library you will feel right at home, we have taken familiar fundamentals and concepts from neo4j-graphql-js and extended them.
The latest and greatest stuff exclusive to this new implementation.
https://camo.githubusercontent.com/12c5f97f75a5211dfb7388fb2b4c2905b46ebd3f497e44026e7c28f736b8170a/68747470733a2f2f692e6779617a6f2e636f6d2f32333837343164633133343037376664616466616362363338633830323235652e706e67
type Product {
id: ID
name: String
photos: [Photo] @relationship(type: "HAS_PHOTO", direction: "OUT")
}
type Photo {
id: ID
url: String
name: String
color: Color @relationship(type: "HAS_COLOR", direction: "OUT")
}
type Color {
name: String
}
mutation {
createProducts(
input: [
{
id: "pringles_product_id"
name: "Pringles"
photos: {
create: [
{
id: "green_photo_id"
url: "green_photo_url.com"
name: "Green photo"
color: { connect: { where: { name: "Green" } } } # existing color
}
{
id: "red_photo_id"
url: "red_photo_url.com"
name: "Red photo"
color: { connect: { where: { name: "Red" } } } # existing color
}
]
}
}
]
) {
id
}
}
mutation {
product: CreateProduct(id: "pringles_product_id", name: "Pringles") {
id
}
greenPhoto: CreatePhoto(
id: "green_photo_id"
url: "green_photo_url.com"
name: "Green Photo"
) {
id
}
connectedProductGreenPhoto: MergeProductPhotos(
from: { id: "pringles_product_id" }
to: { id: "green_photo_id" }
) {
to {
id
}
}
connectGreenPhotoColor: AddPhotoColor(
from: { id: "green_photo_id" }
to: { name: "Green" }
) {
to {
name
}
}
redPhoto: CreatePhoto(
id: "red_photo_id"
url: "red_photo_url.com"
name: "Red Photo"
) {
id
}
connectedProductRedPhoto: MergeProductPhotos(
from: { id: "pringles_product_id" }
to: { id: "red_photo_id" }
) {
to {
id
}
}
connectRedPhotoColor: AddPhotoColor(
from: { id: "red_photo_id" }
to: { name: "Red" }
) {
to {
name
}
}
}
With the existing implementation, here, we found the problem is that logic is scattered & repeated using three different directives; hasScope, hasRole & isAuthenticated. As well as the repetition of directives you could not define complex, nested & related, authorization rules such as; “grant update access to all moderators of a post”.
req
should be passed through the context
obj;