53 lines
2.4 KiB
Go
53 lines
2.4 KiB
Go
package graph
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"git.dragse.it/anthrove/otter-space-sdk/internal/relations"
|
|
"git.dragse.it/anthrove/otter-space-sdk/internal/user"
|
|
"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 models.AnthroveSourceDomain, userID string, username string) error {
|
|
return user.CreateUserNodeWithSourceRelation(ctx, g.driver, anthroveUserID, sourceDomain, userID, username)
|
|
}
|
|
|
|
func (g *graphConnection) GetUserTagsTroughFavedPosts(ctx context.Context, anthroveUserID models.AnthroveUserID) ([]models.TagsWithFrequency, error) {
|
|
return user.GetUserTagNodeWitRelationToFavedPosts(ctx, g.driver, anthroveUserID)
|
|
}
|
|
|
|
func (g *graphConnection) GetUserFavoritePostsWithPagination(ctx context.Context, anthroveUserID models.AnthroveUserID, skip int, limit int) (*models.FavoriteList, error) {
|
|
return user.GetUserFavoriteNodeWithPagination(ctx, g.driver, anthroveUserID, skip, limit)
|
|
}
|
|
|
|
func (g *graphConnection) GetAnthroveUser(ctx context.Context, anthroveUserID models.AnthroveUserID) (*models.AnthroveUser, error) {
|
|
return user.GetAnthroveUser(ctx, g.driver, anthroveUserID)
|
|
}
|
|
|
|
func (g *graphConnection) GetUserFavoriteCount(ctx context.Context, anthroveUserID models.AnthroveUserID) (int64, error) {
|
|
return user.GetUserFavoritesCount(ctx, g.driver, anthroveUserID)
|
|
}
|
|
|
|
func (g *graphConnection) CheckUserPostLink(ctx context.Context, anthroveUserID models.AnthroveUserID, sourcePostID string, sourceUrl string) (bool, error) {
|
|
return relations.CheckUserToPostLink(ctx, g.driver, anthroveUserID, sourcePostID, sourceUrl)
|
|
}
|
|
|
|
func (g *graphConnection) LinkUserWithPost(ctx context.Context, anthroveUser *models.AnthroveUser, anthrovePost *models.AnthrovePost) error {
|
|
return relations.EstablishUserToPostLink(ctx, g.driver, anthroveUser, anthrovePost)
|
|
}
|
|
|
|
func (g *graphConnection) GetAllAnthroveUserIDs(ctx context.Context) ([]models.AnthroveUserID, error) {
|
|
return user.GetAllAnthroveUserIDs(ctx, g.driver)
|
|
}
|