2024-05-28 19:21:08 +00:00
|
|
|
package graph
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2024-05-31 12:42:53 +00:00
|
|
|
|
2024-05-28 19:21:08 +00:00
|
|
|
"git.dragse.it/anthrove/otter-space-sdk/pkg/models"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Post interface {
|
2024-05-31 13:05:47 +00:00
|
|
|
|
|
|
|
// CreatePost will always create a new node, it does not check if the node with the corresponding post_id and rating exists.
|
2024-05-28 19:21:08 +00:00
|
|
|
CreatePost(ctx context.Context, anthrovePost *models.AnthrovePost) error
|
2024-05-31 13:05:47 +00:00
|
|
|
|
|
|
|
// DeletePost will always delete a node, it only needs the anthrovePost.PostID filled out.
|
2024-05-31 12:42:53 +00:00
|
|
|
DeletePost(ctx context.Context, anthrovePost *models.AnthrovePost) error
|
2024-05-28 19:21:08 +00:00
|
|
|
|
2024-05-31 13:05:04 +00:00
|
|
|
// CheckPostNodeExistsBySourceID checks if a post node exists in the OtterSpace graph by its source ID.
|
|
|
|
// It returns the post if it exists, a boolean indicating whether the post was found, and an error if the operation fails.
|
|
|
|
CheckPostNodeExistsBySourceID(ctx context.Context, sourcePostID string) (*models.AnthrovePost, bool, error)
|
2024-05-28 19:21:08 +00:00
|
|
|
|
|
|
|
// CheckPostNodeExistsByAnthroveID checks if a post node exists in the OtterSpace graph by its Anthrove ID.
|
|
|
|
// It returns the post if it exists, a boolean indicating whether the post was found, and an error if the operation fails.
|
|
|
|
CheckPostNodeExistsByAnthroveID(ctx context.Context, anthrovePost *models.AnthrovePost) (*models.AnthrovePost, bool, error)
|
|
|
|
|
|
|
|
// CheckPostNodeExistsBySourceURL checks if a post node exists in the OtterSpace graph by its source URL.
|
|
|
|
// It returns the post if it exists, a boolean indicating whether the post was found, and an error if the operation fails.
|
|
|
|
CheckPostNodeExistsBySourceURL(ctx context.Context, sourceUrl string) (*models.AnthrovePost, bool, error)
|
|
|
|
|
2024-05-31 13:05:04 +00:00
|
|
|
// LinkPostWithSource establishes a link between a post and a source in the OtterSpace graph.
|
2024-05-31 14:05:27 +00:00
|
|
|
LinkPostWithSource(ctx context.Context, anthrovePostID models.AnthrovePostID, anthroveSourceDomain models.AnthroveSourceDomain, anthrovePostRelationship *models.AnthrovePostRelationship) error
|
2024-05-28 19:21:08 +00:00
|
|
|
}
|