41 lines
2.2 KiB
Go
41 lines
2.2 KiB
Go
package graph
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.dragse.it/anthrove/otter-space-sdk/pkg/models"
|
|
)
|
|
|
|
type User interface {
|
|
CreateUser(ctx context.Context, anthroveUserID models.AnthroveUserID) error
|
|
DeleteUser(ctx context.Context, anthroveUserID models.AnthroveUserID) error
|
|
|
|
// CreateUserWithRelationToSource will create or get a user to link it with a given source.
|
|
CreateUserWithRelationToSource(ctx context.Context, anthroveUserID models.AnthroveUserID, sourceDomain models.AnthroveSourceDomain, userID string, username string) error
|
|
|
|
// LinkUserWithPost creates a link between a user and a post in the OtterSpace graph.
|
|
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 OtterSpace graph.
|
|
// It returns true if the link exists, false otherwise, and an error if the operation fails.
|
|
CheckUserPostLink(ctx context.Context, anthroveUserID models.AnthroveUserID, sourcePostID string, sourceUrl string) (bool, error)
|
|
|
|
// GetUserFavoriteCount retrieves the count of a user's favorite posts from the OtterSpace graph.
|
|
// It returns the count and an error if the operation fails.
|
|
GetUserFavoriteCount(ctx context.Context, anthroveUserID models.AnthroveUserID) (int64, error)
|
|
|
|
// GetAnthroveUser retrieves a user from the OtterSpace graph by their ID.
|
|
// It returns the user and an error if the operation fails.
|
|
GetAnthroveUser(ctx context.Context, anthroveUserID models.AnthroveUserID) (*models.AnthroveUser, error)
|
|
|
|
// GetUserFavoritePostsWithPagination gets all user favorites with relations and sources for the given user
|
|
GetUserFavoritePostsWithPagination(ctx context.Context, anthroveUserID models.AnthroveUserID, skip int, limit int) (*models.FavoriteList, error)
|
|
|
|
// GetUserTagsTroughFavedPosts returns a list of Tags that the user hs favorites through a post
|
|
GetUserTagsTroughFavedPosts(ctx context.Context, anthroveUserID models.AnthroveUserID) ([]models.TagsWithFrequency, error)
|
|
|
|
// GetAllAnthroveUserIDs retrieves all user IDs from the OtterSpace graph.
|
|
// It returns a slice of user IDs and an error if the operation fails.
|
|
GetAllAnthroveUserIDs(ctx context.Context) ([]models.AnthroveUserID, error)
|
|
}
|