2024-06-28 08:54:42 +00:00
|
|
|
package database
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"git.dragse.it/anthrove/otter-space-sdk/pkg/models"
|
|
|
|
)
|
|
|
|
|
|
|
|
type User interface {
|
|
|
|
|
|
|
|
// CreateUserWithRelationToSource adds a user with a relation to a source.
|
|
|
|
CreateUserWithRelationToSource(ctx context.Context, anthroveUserID models.AnthroveUserID, sourceID models.AnthroveSourceID, accountId string, accountUsername string) error
|
2024-06-28 10:15:51 +00:00
|
|
|
|
2024-06-28 08:54:42 +00:00
|
|
|
// CreateReferenceBetweenUserAndPost links a user with a post.
|
|
|
|
CreateReferenceBetweenUserAndPost(ctx context.Context, anthroveUserID models.AnthroveUserID, anthrovePostID models.AnthrovePostID) error
|
2024-06-28 08:58:07 +00:00
|
|
|
|
|
|
|
UpdateUserSourceScrapeTimeInterval(ctx context.Context, anthroveUserID models.AnthroveUserID, sourceID models.AnthroveSourceID, scrapeTime models.AnthroveScrapeTimeInterval) error
|
2024-06-28 10:15:51 +00:00
|
|
|
|
2024-06-28 08:58:07 +00:00
|
|
|
UpdateUserSourceLastScrapeTime(ctx context.Context, anthroveUserID models.AnthroveUserID, sourceID models.AnthroveSourceID, lastScrapeTime models.AnthroveUserLastScrapeTime) error
|
|
|
|
|
|
|
|
UpdateUserSourceValidation(ctx context.Context, anthroveUserID models.AnthroveUserID, sourceID models.AnthroveSourceID, valid bool) error
|
2024-06-28 10:15:51 +00:00
|
|
|
|
2024-06-28 12:16:28 +00:00
|
|
|
GetAllUsers(ctx context.Context) ([]models.User, error)
|
2024-06-28 10:15:51 +00:00
|
|
|
|
|
|
|
// GetUserFavoritesCount retrieves the count of a user's favorites.
|
|
|
|
GetUserFavoritesCount(ctx context.Context, anthroveUserID models.AnthroveUserID) (int64, error)
|
|
|
|
|
|
|
|
// GetAllUserSources retrieves the source links of a user.
|
|
|
|
GetAllUserSources(ctx context.Context, anthroveUserID models.AnthroveUserID) (map[string]models.UserSource, error)
|
|
|
|
|
|
|
|
// GetUserSourceBySourceID retrieves a specified source link of a user.
|
|
|
|
GetUserSourceBySourceID(ctx context.Context, anthroveUserID models.AnthroveUserID, sourceID models.AnthroveSourceID) (*models.UserSource, error)
|
|
|
|
|
|
|
|
// GetAllUserFavoritesWithPagination retrieves a user's favorite posts with pagination.
|
|
|
|
GetAllUserFavoritesWithPagination(ctx context.Context, anthroveUserID models.AnthroveUserID, skip int, limit int) (*models.FavoriteList, error)
|
|
|
|
|
|
|
|
// GetAllTagsFromUser retrieves a user's tags through their favorite posts.
|
|
|
|
GetAllTagsFromUser(ctx context.Context, anthroveUserID models.AnthroveUserID) ([]models.TagsWithFrequency, error)
|
|
|
|
|
|
|
|
// CheckIfUserHasPostAsFavorite checks if a user-post link exists.
|
|
|
|
CheckIfUserHasPostAsFavorite(ctx context.Context, anthroveUserID models.AnthroveUserID, sourcePostID models.AnthrovePostID) (bool, error)
|
2024-06-28 08:54:42 +00:00
|
|
|
}
|