2024-05-28 19:21:08 +00:00
|
|
|
package graph
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
2024-05-31 13:08:24 +00:00
|
|
|
|
2024-05-31 13:24:05 +00:00
|
|
|
"git.dragse.it/anthrove/otter-space-sdk/internal/relations"
|
2024-05-31 13:08:24 +00:00
|
|
|
"git.dragse.it/anthrove/otter-space-sdk/internal/user"
|
2024-05-28 19:21:08 +00:00
|
|
|
"git.dragse.it/anthrove/otter-space-sdk/pkg/models"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (g *graphConnection) CreateUser(ctx context.Context, anthroveUserID models.AnthroveUserID) error {
|
|
|
|
//TODO implement me
|
|
|
|
return fmt.Errorf("not implemented! Use the CreateUserWithRelationToSource function to create a user")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (g *graphConnection) DeleteUser(ctx context.Context, anthroveUserID models.AnthroveUserID) error {
|
|
|
|
//TODO implement me
|
|
|
|
return fmt.Errorf("not implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (g *graphConnection) CreateUserWithRelationToSource(ctx context.Context, anthroveUserID models.AnthroveUserID, sourceDomain string, userID string, username string) error {
|
2024-05-31 13:08:24 +00:00
|
|
|
return user.CreateUserNodeWithSourceRelation(ctx, g.driver, anthroveUserID, sourceDomain, userID, username)
|
2024-05-28 19:21:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (g *graphConnection) GetUserTagsTroughFavedPosts(ctx context.Context, anthroveUserID models.AnthroveUserID) ([]models.TagsWithFrequency, error) {
|
2024-05-31 13:08:24 +00:00
|
|
|
return user.GetUserTagNodeWitRelationToFavedPosts(ctx, g.driver, anthroveUserID)
|
2024-05-28 19:21:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (g *graphConnection) GetUserFavoritePostsWithPagination(ctx context.Context, anthroveUserID models.AnthroveUserID, skip int, limit int) (*models.FavoriteList, error) {
|
2024-05-31 13:08:24 +00:00
|
|
|
return user.GetUserFavoriteNodeWithPagination(ctx, g.driver, anthroveUserID, skip, limit)
|
2024-05-28 19:21:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (g *graphConnection) GetAnthroveUser(ctx context.Context, anthroveUserID models.AnthroveUserID) (*models.AnthroveUser, error) {
|
2024-05-31 13:08:24 +00:00
|
|
|
return user.GetAnthroveUser(ctx, g.driver, anthroveUserID)
|
2024-05-28 19:21:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (g *graphConnection) GetUserFavoriteCount(ctx context.Context, anthroveUserID models.AnthroveUserID) (int64, error) {
|
2024-05-31 13:08:24 +00:00
|
|
|
return user.GetUserFavoritesCount(ctx, g.driver, anthroveUserID)
|
2024-05-28 19:21:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (g *graphConnection) CheckUserPostLink(ctx context.Context, anthroveUserID models.AnthroveUserID, sourcePostID string, sourceUrl string) (bool, error) {
|
2024-05-31 13:24:05 +00:00
|
|
|
return relations.CheckUserToPostLink(ctx, g.driver, anthroveUserID, sourcePostID, sourceUrl)
|
2024-05-28 19:21:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (g *graphConnection) LinkUserWithPost(ctx context.Context, anthroveUser *models.AnthroveUser, anthrovePost *models.AnthrovePost) error {
|
2024-05-31 13:24:05 +00:00
|
|
|
return relations.EstablishUserToPostLink(ctx, g.driver, anthroveUser, anthrovePost)
|
2024-05-28 19:21:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (g *graphConnection) GetAllAnthroveUserIDs(ctx context.Context) ([]models.AnthroveUserID, error) {
|
2024-05-31 13:08:24 +00:00
|
|
|
return user.GetAllAnthroveUserIDs(ctx, g.driver)
|
2024-05-28 19:21:08 +00:00
|
|
|
}
|