From 1679c104bdad7169ccd178422976765f0f5e92d8 Mon Sep 17 00:00:00 2001 From: soxx Date: Sat, 17 Feb 2024 16:36:04 +0100 Subject: [PATCH] fix: removed unneeded return --- internal/user.go | 11 +++-------- pkg/graph/impl.go | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/internal/user.go b/internal/user.go index 97faef3..3600f56 100644 --- a/internal/user.go +++ b/internal/user.go @@ -10,7 +10,7 @@ import ( log "github.com/sirupsen/logrus" ) -func CreateUserNodeWithSourceRelation(ctx context.Context, driver neo4j.DriverWithContext, anthroveUserID models.AnthroveUserID, sourceDomain string, userID string, username string) (*models.AnthroveUser, error) { +func CreateUserNodeWithSourceRelation(ctx context.Context, driver neo4j.DriverWithContext, anthroveUserID models.AnthroveUserID, sourceDomain string, userID string, username string) error { query := ` MATCH (userNode:User {user_id: $anthrove_user_id}) MATCH (sourceNode:Source {domain: $source_domain}) @@ -25,7 +25,7 @@ func CreateUserNodeWithSourceRelation(ctx context.Context, driver neo4j.DriverWi _, err := neo4j.ExecuteQuery(ctx, driver, query, params, neo4j.EagerResultTransformer) if err != nil { - return nil, err + return err } var anthroveUserRelationship []models.AnthroveUserRelationship @@ -41,11 +41,6 @@ func CreateUserNodeWithSourceRelation(ctx context.Context, driver neo4j.DriverWi }, }) - anthroveUser := models.AnthroveUser{ - UserID: anthroveUserID, - Relationship: anthroveUserRelationship, - } - log.WithFields(log.Fields{ "anthrove_user_id": anthroveUserID, "source_user_id": userID, @@ -53,7 +48,7 @@ func CreateUserNodeWithSourceRelation(ctx context.Context, driver neo4j.DriverWi "source_domain": sourceDomain, }).Trace("graph: crated user with relationship") - return &anthroveUser, nil + return nil } func GetUserFavoritesCount(ctx context.Context, driver neo4j.DriverWithContext, anthroveUserID models.AnthroveUserID) (int64, error) { diff --git a/pkg/graph/impl.go b/pkg/graph/impl.go index 4037612..cc3eafc 100644 --- a/pkg/graph/impl.go +++ b/pkg/graph/impl.go @@ -36,7 +36,7 @@ func (g *graphConnection) Connect(ctx context.Context, endpoint string, username return nil } -func (g *graphConnection) AddUserWithRelationToSource(ctx context.Context, anthroveUserID models.AnthroveUserID, sourceDomain string, userID string, username string) (*models.AnthroveUser, error) { +func (g *graphConnection) AddUserWithRelationToSource(ctx context.Context, anthroveUserID models.AnthroveUserID, sourceDomain string, userID string, username string) error { return internal.CreateUserNodeWithSourceRelation(ctx, g.driver, anthroveUserID, sourceDomain, userID, username) }