This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
otter-space-sdk/pkg/graph/source_impl.go

36 lines
1.5 KiB
Go
Raw Normal View History

package graph
import (
"context"
"git.dragse.it/anthrove/otter-space-sdk/internal/source"
"git.dragse.it/anthrove/otter-space-sdk/internal/user"
"git.dragse.it/anthrove/otter-space-sdk/pkg/models"
)
// CreateSource will always create a new node, it checks if a node with the same url exits and merges it.
func (g *graphConnection) CreateSource(ctx context.Context, anthroveSource *models.AnthroveSource) error {
return source.CreateSourceNode(ctx, g.driver, anthroveSource)
}
// DeleteSource will delete a node with a given Domain
func (g *graphConnection) DeleteSource(ctx context.Context, anthroveSource *models.AnthroveSource) error {
return source.DeleteSourceNode(ctx, g.driver, anthroveSource)
}
func (g *graphConnection) GetSourceByURL(ctx context.Context, sourceUrl string) (*models.AnthroveSource, error) {
return source.GetSourceNodesByURL(ctx, g.driver, sourceUrl)
}
func (g *graphConnection) GetAllSources(ctx context.Context) ([]models.AnthroveSource, error) {
return source.GetAllSourceNodes(ctx, g.driver)
}
func (g *graphConnection) GetSourceLinkForSpecifiedUser(ctx context.Context, anthroveUserID models.AnthroveUserID, sourceDisplayName string) (map[string]models.AnthroveUserRelationship, error) {
return user.GetSpecifiedUserSourceLink(ctx, g.driver, anthroveUserID, sourceDisplayName)
}
func (g *graphConnection) GetSourceLinkForUser(ctx context.Context, anthroveUserID models.AnthroveUserID) (map[string]models.AnthroveUserRelationship, error) {
return user.GetUserSourceLink(ctx, g.driver, anthroveUserID)
}