43 lines
2.3 KiB
Go
43 lines
2.3 KiB
Go
package database
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.anthrove.art/Anthrove/otter-space-sdk/v2/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
|
|
|
|
// CreateReferenceBetweenUserAndPost links a user with a post.
|
|
CreateReferenceBetweenUserAndPost(ctx context.Context, anthroveUserID models.AnthroveUserID, anthrovePostID models.AnthrovePostID) error
|
|
|
|
UpdateUserSourceScrapeTimeInterval(ctx context.Context, anthroveUserID models.AnthroveUserID, sourceID models.AnthroveSourceID, scrapeTime models.AnthroveScrapeTimeInterval) error
|
|
|
|
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
|
|
|
|
GetAllUsers(ctx context.Context) ([]models.User, error)
|
|
|
|
// 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)
|
|
}
|