cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Using root object in resolver function to access parent fields properties

I am using neo4j-graphql-js library to auto generate resolvers from the schema. For a node in the schema(Employee) i need to get a particular node property(empid) from a rest call as we plan to remove that property from our neo4j database due to privacy issues. I am trying to write a custom resolver for that field . I have added @neo4j directive to that field in the schema for neo4j to ignore it. I need to make a rest call that accepts a parameter named uid and returns the corressponding empid. This iuid is a property of Employee node and so is present in my neo4j DB.
The issue is while writing the resolver the root objects only holds the filed values accesed in the query. So if iuid is not part of the query i'm unable to get it's value in the root obj.
Here is my employee node: -
2X_4_45dfb168a2f30929f06177b91b0d6d9b100d8d6d.png
Here is my resolver where for my i am returning a dummy string instead of making a rest call: -
2X_6_67cb4ec2c725e2dffd2a270eeade78436e15e459.png
Here is my query: -

{
Employee(first : 10)
{
empId
name

}

}

I want to access all the value of all the field of the employee node so i can get the iuid. I don't know even if it is possible and if not is there any workaround this?

6 REPLIES 6

MuddyBootsCode
Graph Steward

Your employee node is going to need some kind of uuid to be accessed. If you're looking for way to make a slug or some kind of identifier that doesn't expose your information then you'll have to figure out a way to do that and keep it anonymous outside of excluding it.

My question is that what i was trying to do is possible or not? The employee details needs to come from other DB but for that i need the iuid of the current employee node that is being queried even though iuid will not be a part of the query. If not possible then is there any other way to hide/protect these employee details in my neo4j database?

Here is a part of my Employee node type defined in schema:-
type Employee{
empId: String
buCode: String
iuid: String
name: String
projectCode: String
roleCode: String
grade: String
mailid: String
duCode: String
txtmailid_new: String
uuid: String
confirmed: String
joinedDate: String
WORKED_IN: [Worked]
Since I can't edit the post here is the question with more details:-

MuddyBootsCode
Graph Steward

It's possible if you salt the information and store it that way in the Neo4j instance. Otherwise I'd say no.

Sorry but I did not get what you meant by salt the information.

MuddyBootsCode
Graph Steward