From dfac1c715e8828afe2c4f073eb74bf1cf740d601 Mon Sep 17 00:00:00 2001 From: Romain Jeannoutot Date: Thu, 21 Apr 2022 15:26:29 +0200 Subject: [PATCH] feat(neo4j): set priority to overrided roles in organizations --- neo4j/user.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/neo4j/user.go b/neo4j/user.go index 1a8217b..b8f32d4 100644 --- a/neo4j/user.go +++ b/neo4j/user.go @@ -29,14 +29,14 @@ func (r *UserRepository) FetchUserOrganizations(ctx context.Context, userID stri defer session.Close() res, err := session.Run(` - match (u:User {user_id: $user_id})-[ruo:WORKS_AT|BUY_FOR|MANAGE|OWN|DEALS_WITH]->(o:Organization) - return o.organization_id as organization_id, type(ruo) as role - union all match (u:User {user_id: $user_id})-[ruh:WORKS_AT|BUY_FOR|MANAGE|OWN]->(h:Organization)-[rhn:HEAD_OF]->(n:Network)<-[ron:IN]-(o:Organization) return o.organization_id as organization_id, 'WORKS_AT' as role - union all + union all match (u:User {user_id: $user_id})-[ruh:DEALS_WITH]->(h:Organization)-[rhn:HEAD_OF]->(n:Network)<-[ron:IN]-(o:Organization) return o.organization_id as organization_id, 'DEALS_WITH' as role + union all + match (u:User {user_id: $user_id})-[ruo:WORKS_AT|BUY_FOR|MANAGE|OWN|DEALS_WITH]->(o:Organization) + return o.organization_id as organization_id, type(ruo) as role `, map[string]interface{}{ "user_id": userID, })