Compare commits

..

No commits in common. "175fb4daab061839a002e7a8cbdb0a6e77c0c771" and "2fadc03e4ce1ec76bf182d65484c2cbb7b426788" have entirely different histories.

View File

@ -4,6 +4,7 @@ import (
"context"
"fmt"
"git.dragse.it/anthrove/otter-space-sdk/internal/utils"
"git.dragse.it/anthrove/otter-space-sdk/pkg/models"
"github.com/neo4j/neo4j-go-driver/v5/neo4j"
log "github.com/sirupsen/logrus"
@ -95,7 +96,7 @@ func GetUserSourceLink(ctx context.Context, driver neo4j.DriverWithContext, anth
query := `
MATCH (user:User{user_id: $anthrove_user_id})-[r:HAS_ACCOUNT_AT]->(s:Source)
RETURN toString(r.user_id) AS sourceUserID, toString(r.username) AS sourceUsername, s as source;
RETURN toString(r.user_id) AS sourceUserID, toString(r.username) AS sourceUsername, s.display_name as sourceDisplayName;
`
params := map[string]any{
"anthrove_user_id": anthroveUserID,
@ -112,7 +113,7 @@ func GetUserSourceLink(ctx context.Context, driver neo4j.DriverWithContext, anth
for i := range result.Records {
record := result.Records[i]
source, _, err := neo4j.GetRecordValue[neo4j.Node](record, "source")
sourceName, _, err := neo4j.GetRecordValue[string](record, "sourceDisplayName")
if err != nil {
return nil, err
}
@ -125,20 +126,11 @@ func GetUserSourceLink(ctx context.Context, driver neo4j.DriverWithContext, anth
return nil, err
}
displayName := source.Props["display_name"].(string)
domain := source.Props["domain"].(string)
icon := source.Props["icon"].(string)
anthroveSourceUser := models.AnthroveUserRelationship{
UserID: sourceUserID,
Username: sourceUsername,
Source: models.AnthroveSource{
DisplayName: displayName,
Domain: domain,
Icon: icon,
},
}
userSource[displayName] = anthroveSourceUser
userSource[sourceName] = anthroveSourceUser
}
log.WithFields(log.Fields{