fix: renamed attributes and removed unneeded pointer
This commit is contained in:
parent
06fa9a1d5a
commit
5435f8448d
@ -64,7 +64,7 @@ func EstablishUserToPostLink(ctx context.Context, driver neo4j.DriverWithContext
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func CheckUserToPostLink(ctx context.Context, driver neo4j.DriverWithContext, anthroveUserID models.AnthroveUserID, sourcePostID string, sourcePostUrl string) (bool, error) {
|
func CheckUserToPostLink(ctx context.Context, driver neo4j.DriverWithContext, anthroveUserID models.AnthroveUserID, sourcePostID string, sourceUrl string) (bool, error) {
|
||||||
query := `
|
query := `
|
||||||
OPTIONAL MATCH (:User {user_id: $anthrove_user_id})-[f:FAV]->(:AnthrovePost)<-[:REFERENCE{source_post_id: $source_post_id}]-(:Source{domain: $source_domain})
|
OPTIONAL MATCH (:User {user_id: $anthrove_user_id})-[f:FAV]->(:AnthrovePost)<-[:REFERENCE{source_post_id: $source_post_id}]-(:Source{domain: $source_domain})
|
||||||
RETURN COUNT(f) > 0 AS hasRelationship
|
RETURN COUNT(f) > 0 AS hasRelationship
|
||||||
@ -73,7 +73,7 @@ func CheckUserToPostLink(ctx context.Context, driver neo4j.DriverWithContext, an
|
|||||||
params := map[string]any{
|
params := map[string]any{
|
||||||
"anthrove_user_id": anthroveUserID,
|
"anthrove_user_id": anthroveUserID,
|
||||||
"source_post_id": sourcePostID,
|
"source_post_id": sourcePostID,
|
||||||
"source_domain": sourcePostUrl,
|
"source_domain": sourceUrl,
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := neo4j.ExecuteQuery(ctx, driver, query, params, neo4j.EagerResultTransformer)
|
result, err := neo4j.ExecuteQuery(ctx, driver, query, params, neo4j.EagerResultTransformer)
|
||||||
|
@ -20,7 +20,7 @@ type OtterSpace interface {
|
|||||||
AddPost(ctx context.Context, anthrovePost *models.AnthrovePost) error
|
AddPost(ctx context.Context, anthrovePost *models.AnthrovePost) error
|
||||||
|
|
||||||
// AddTagWithRelationToPost uploads a tag associated with an Anthrove post to the graph
|
// AddTagWithRelationToPost uploads a tag associated with an Anthrove post to the graph
|
||||||
AddTagWithRelationToPost(ctx context.Context, anthrovePostID *models.AnthrovePostID, anthroveTag *models.AnthroveTag) error
|
AddTagWithRelationToPost(ctx context.Context, anthrovePostID models.AnthrovePostID, anthroveTag *models.AnthroveTag) error
|
||||||
|
|
||||||
// LinkPostWithSource establishes a link between a post and a source in the graph
|
// LinkPostWithSource establishes a link between a post and a source in the graph
|
||||||
LinkPostWithSource(ctx context.Context, anthrovePostID models.AnthrovePostID, anthroveSourceDomain string, anthrovePostRelationship *models.AnthrovePostRelationship) error
|
LinkPostWithSource(ctx context.Context, anthrovePostID models.AnthrovePostID, anthroveSourceDomain string, anthrovePostRelationship *models.AnthrovePostRelationship) error
|
||||||
@ -29,7 +29,7 @@ type OtterSpace interface {
|
|||||||
LinkUserWithPost(ctx context.Context, anthroveUser *models.AnthroveUser, anthrovePost *models.AnthrovePost) error
|
LinkUserWithPost(ctx context.Context, anthroveUser *models.AnthroveUser, anthrovePost *models.AnthrovePost) error
|
||||||
|
|
||||||
// CheckUserPostLink checks if a link between a user and a post exists in the graph
|
// CheckUserPostLink checks if a link between a user and a post exists in the graph
|
||||||
CheckUserPostLink(ctx context.Context, anthroveUserID models.AnthroveUserID, sourcePostID string, sourcePostUrl string) (bool, error)
|
CheckUserPostLink(ctx context.Context, anthroveUserID models.AnthroveUserID, sourcePostID string, sourceUrl string) (bool, error)
|
||||||
|
|
||||||
// CheckPostNodeExistsByAnthroveID checks if an Anthrove post node exists in the graph by its Anthrove ID
|
// CheckPostNodeExistsByAnthroveID checks if an Anthrove post node exists in the graph by its Anthrove ID
|
||||||
CheckPostNodeExistsByAnthroveID(ctx context.Context, anthrovePost *models.AnthrovePost) (*models.AnthrovePost, bool, error)
|
CheckPostNodeExistsByAnthroveID(ctx context.Context, anthrovePost *models.AnthrovePost) (*models.AnthrovePost, bool, error)
|
||||||
|
@ -48,7 +48,7 @@ func (g *graphConnection) AddPost(ctx context.Context, anthrovePost *models.Anth
|
|||||||
return internal.CreateAnthrovePostNode(ctx, g.driver, anthrovePost)
|
return internal.CreateAnthrovePostNode(ctx, g.driver, anthrovePost)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *graphConnection) AddTagWithRelationToPost(ctx context.Context, anthrovePostID *models.AnthrovePostID, anthroveTag *models.AnthroveTag) error {
|
func (g *graphConnection) AddTagWithRelationToPost(ctx context.Context, anthrovePostID models.AnthrovePostID, anthroveTag *models.AnthroveTag) error {
|
||||||
return internal.CreateTagNodeWitRelation(ctx, g.driver, anthrovePostID, anthroveTag)
|
return internal.CreateTagNodeWitRelation(ctx, g.driver, anthrovePostID, anthroveTag)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,8 +60,8 @@ func (g *graphConnection) LinkUserWithPost(ctx context.Context, anthroveUser *mo
|
|||||||
return internal.EstablishUserToPostLink(ctx, g.driver, anthroveUser, anthrovePost)
|
return internal.EstablishUserToPostLink(ctx, g.driver, anthroveUser, anthrovePost)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *graphConnection) CheckUserPostLink(ctx context.Context, anthroveUserID models.AnthroveUserID, sourcePostID string, sourcePostUrl string) (bool, error) {
|
func (g *graphConnection) CheckUserPostLink(ctx context.Context, anthroveUserID models.AnthroveUserID, sourcePostID string, sourceUrl string) (bool, error) {
|
||||||
return internal.CheckUserToPostLink(ctx, g.driver, anthroveUserID, sourcePostID, sourcePostUrl)
|
return internal.CheckUserToPostLink(ctx, g.driver, anthroveUserID, sourcePostID, sourceUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *graphConnection) CheckPostNodeExistsByAnthroveID(ctx context.Context, anthrovePost *models.AnthrovePost) (*models.AnthrovePost, bool, error) {
|
func (g *graphConnection) CheckPostNodeExistsByAnthroveID(ctx context.Context, anthrovePost *models.AnthrovePost) (*models.AnthrovePost, bool, error) {
|
||||||
|
Reference in New Issue
Block a user