feat: implemented getting user sources
This commit is contained in:
parent
9a96e16e63
commit
02733498b9
@ -94,12 +94,12 @@ func GetUserFavoritesCount(ctx context.Context, driver neo4j.DriverWithContext,
|
|||||||
return userFavoriteCount, nil
|
return userFavoriteCount, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetUserWithRelationsAndSource(ctx context.Context, driver neo4j.DriverWithContext, anthroveUserID models.AnthroveUserID) (map[string]models.AnthroveUserRelationship, error) {
|
func GetUserSourceLink(ctx context.Context, driver neo4j.DriverWithContext, anthroveUserID models.AnthroveUserID) (map[string]models.AnthroveUserRelationship, error) {
|
||||||
|
|
||||||
userSource := make(map[string]models.AnthroveUserRelationship)
|
userSource := make(map[string]models.AnthroveUserRelationship)
|
||||||
|
|
||||||
query := `
|
query := `
|
||||||
MATCH (user:User{user_id: $anthrove_user_id})-[r:HAS_ACCOUNT_AT]->(s:Source)
|
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.display_name as sourceDisplayName;
|
RETURN toString(r.user_id) AS sourceUserID, toString(r.username) AS sourceUsername, s.display_name as sourceDisplayName;
|
||||||
`
|
`
|
||||||
params := map[string]any{
|
params := map[string]any{
|
||||||
|
@ -44,7 +44,7 @@ type Graph interface {
|
|||||||
GetUserFavoriteCount(ctx context.Context, anthroveUserID models.AnthroveUserID) (int64, error)
|
GetUserFavoriteCount(ctx context.Context, anthroveUserID models.AnthroveUserID) (int64, error)
|
||||||
|
|
||||||
// GetUserSourceLinks retrieves the links between a user and sources in the graph
|
// GetUserSourceLinks retrieves the links between a user and sources in the graph
|
||||||
GetUserSourceLinks(ctx context.Context, anthroveUser *models.AnthroveUser) (map[string]models.AnthroveUserRelationship, error)
|
GetUserSourceLinks(ctx context.Context, anthroveUserID models.AnthroveUserID) (map[string]models.AnthroveUserRelationship, error)
|
||||||
|
|
||||||
// GetAnthroveUser retrieves an Anthrove user from the graph by their ID
|
// GetAnthroveUser retrieves an Anthrove user from the graph by their ID
|
||||||
GetAnthroveUser(ctx context.Context, anthroveUser *models.AnthroveUser) (*models.AnthroveUser, error)
|
GetAnthroveUser(ctx context.Context, anthroveUser *models.AnthroveUser) (*models.AnthroveUser, error)
|
||||||
|
@ -80,9 +80,8 @@ func (g *graphConnection) GetUserFavoriteCount(ctx context.Context, anthroveUser
|
|||||||
return internal.GetUserFavoritesCount(ctx, g.driver, anthroveUserID)
|
return internal.GetUserFavoritesCount(ctx, g.driver, anthroveUserID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *graphConnection) GetUserSourceLinks(ctx context.Context, anthroveUser *models.AnthroveUser) (map[string]models.AnthroveUserRelationship, error) {
|
func (g *graphConnection) GetUserSourceLinks(ctx context.Context, anthroveUserID models.AnthroveUserID) (map[string]models.AnthroveUserRelationship, error) {
|
||||||
//TODO implement me
|
return internal.GetUserSourceLink(ctx, g.driver, anthroveUserID)
|
||||||
panic("implement me")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *graphConnection) GetAnthroveUser(ctx context.Context, anthroveUser *models.AnthroveUser) (*models.AnthroveUser, error) {
|
func (g *graphConnection) GetAnthroveUser(ctx context.Context, anthroveUser *models.AnthroveUser) (*models.AnthroveUser, error) {
|
||||||
|
Reference in New Issue
Block a user