2024-06-03 17:31:25 +00:00
|
|
|
package database
|
2024-02-16 14:16:50 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2024-02-16 20:51:09 +00:00
|
|
|
"git.dragse.it/anthrove/otter-space-sdk/pkg/models"
|
2024-02-16 14:16:50 +00:00
|
|
|
)
|
|
|
|
|
2024-02-16 20:57:54 +00:00
|
|
|
type OtterSpace interface {
|
2024-06-03 19:31:44 +00:00
|
|
|
Connect(ctx context.Context, endpoint string, username string, password string, database string, port int, ssl string, timezone string) error
|
2024-02-16 14:16:50 +00:00
|
|
|
|
2024-02-17 15:35:53 +00:00
|
|
|
AddUserWithRelationToSource(ctx context.Context, anthroveUserID models.AnthroveUserID, sourceDomain string, userID string, username string) error
|
2024-02-16 14:16:50 +00:00
|
|
|
|
2024-06-22 20:06:36 +00:00
|
|
|
AddSource(ctx context.Context, anthroveSource *models.Source) error
|
2024-02-16 14:16:50 +00:00
|
|
|
|
2024-06-22 20:06:36 +00:00
|
|
|
AddPost(ctx context.Context, anthrovePost *models.Post) error
|
2024-02-16 14:16:50 +00:00
|
|
|
|
2024-06-22 20:06:36 +00:00
|
|
|
AddTagWithRelationToPost(ctx context.Context, anthrovePostID models.AnthrovePostID, anthroveTag *models.Tag) error
|
2024-02-16 14:16:50 +00:00
|
|
|
|
2024-06-22 20:06:36 +00:00
|
|
|
LinkPostWithSource(ctx context.Context, anthrovePostID models.AnthrovePostID, anthroveSourceDomain string, anthrovePostRelationship *models.PostReference) error
|
2024-02-16 14:16:50 +00:00
|
|
|
|
2024-06-22 20:06:36 +00:00
|
|
|
LinkUserWithPost(ctx context.Context, anthroveUser *models.User, anthrovePost *models.Post) error
|
2024-02-16 14:16:50 +00:00
|
|
|
|
2024-02-16 22:11:42 +00:00
|
|
|
CheckUserPostLink(ctx context.Context, anthroveUserID models.AnthroveUserID, sourcePostID string, sourceUrl string) (bool, error)
|
2024-02-16 14:16:50 +00:00
|
|
|
|
2024-06-22 20:27:38 +00:00
|
|
|
CheckPostNodeExistsByAnthroveID(ctx context.Context, anthrovePost *models.Post) (*models.Post, error)
|
2024-02-16 14:16:50 +00:00
|
|
|
|
2024-06-22 20:27:38 +00:00
|
|
|
CheckPostNodeExistsBySourceURL(ctx context.Context, sourceUrl string) (*models.Post, error)
|
2024-02-16 14:16:50 +00:00
|
|
|
|
2024-06-22 20:27:38 +00:00
|
|
|
CheckPostNodeExistsBySourceID(ctx context.Context, sourcePostID string) (*models.Post, error)
|
2024-02-16 14:16:50 +00:00
|
|
|
|
2024-02-16 20:28:26 +00:00
|
|
|
GetUserFavoriteCount(ctx context.Context, anthroveUserID models.AnthroveUserID) (int64, error)
|
2024-02-16 14:16:50 +00:00
|
|
|
|
2024-06-22 20:06:36 +00:00
|
|
|
GetUserSourceLinks(ctx context.Context, anthroveUserID models.AnthroveUserID) (map[string]models.UserSource, error)
|
2024-02-16 14:16:50 +00:00
|
|
|
|
2024-06-22 20:06:36 +00:00
|
|
|
GetSpecifiedUserSourceLink(ctx context.Context, anthroveUserID models.AnthroveUserID, sourceDisplayName string) (map[string]models.UserSource, error)
|
2024-05-04 22:17:18 +00:00
|
|
|
|
2024-06-22 20:06:36 +00:00
|
|
|
GetAnthroveUser(ctx context.Context, anthroveUserID models.AnthroveUserID) (*models.User, error)
|
2024-02-16 14:16:50 +00:00
|
|
|
|
|
|
|
GetAllAnthroveUserIDs(ctx context.Context) ([]models.AnthroveUserID, error)
|
2024-05-10 08:57:51 +00:00
|
|
|
|
2024-06-22 20:06:36 +00:00
|
|
|
GetUserFavoritePostsWithPagination(ctx context.Context, anthroveUserID models.AnthroveUserID, skip int, limit int) (*models.FavoriteList, error)
|
2024-05-15 13:18:23 +00:00
|
|
|
|
2024-06-22 20:06:36 +00:00
|
|
|
GetUserTagsTroughFavedPosts(ctx context.Context, anthroveUserID models.AnthroveUserID) ([]models.TagsWithFrequency, error)
|
2024-05-15 13:31:17 +00:00
|
|
|
|
2024-06-22 20:06:36 +00:00
|
|
|
GetAllTags(ctx context.Context) ([]models.TagsWithFrequency, error)
|
2024-05-15 13:44:34 +00:00
|
|
|
|
2024-06-22 20:06:36 +00:00
|
|
|
GetAllSources(ctx context.Context) ([]models.Source, error)
|
2024-05-21 09:48:03 +00:00
|
|
|
|
2024-06-22 20:06:36 +00:00
|
|
|
GetSourceByURL(ctx context.Context, sourceUrl string) (*models.Source, error)
|
2024-02-16 14:16:50 +00:00
|
|
|
}
|