ports

package
v0.0.0-...-5d3eb43 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
}

type Repository

type Repository interface {
	CreateUser(newUser *domain.User) (int64, error)
	GetUserByID(id int64) (*domain.User, error)
	GetUserIDByEmail(email string) (int64, error)
	GetUserIDByUsername(username string) (int64, error)
	GetUsersWithOptions(options *domain.SearchUsersOptions) ([]domain.User, error)
	UpdateUserByID(updatedUser *domain.User) error
	DeleteUserByID(id int64) error

	CreateTopic(newTopic *domain.Topic) (int64, error)
	GetTopicByID(id int64) (*domain.Topic, error)
	GetTopicID(topic string, hub string) (int64, error)
	GetTopicsWithOptions(options *domain.SearchTopicsOptions) ([]domain.Topic, error)
	UpdateTopicByID(id int64, description string) error

	CreatePost(newPost *domain.Post) (int64, error)
	GetPostByID(id int64) (*domain.Post, error)
	GetPostsWithOptions(options *domain.SearchPostsOptions) ([]domain.Post, error)
	CountPostsFromAuthorID(userID int64) (int64, error)
	UpdatePostByID(updatedPost *domain.Post) error
	MarkPostAsDeletedByID(id int64, reason string, moderatorID int64) error

	CreateComment(newComment *domain.Comment) (int64, error)
	GetCommentByID(id int64) (*domain.Comment, error)
	GetCommentsWithOptions(options *domain.SearchCommentsOptions) ([]domain.Comment, error)
	UpdateCommentByID(updatedComment *domain.Comment) error
	MarkCommentAsDeletedByID(id int64, reason string, moderatorID int64) error

	CreateTag(newTag *domain.Tag) (int64, error)
	GetTagByID(id int64) (*domain.Tag, error)
	GetTagsWithOptions(options *domain.SearchTagsOptions) ([]domain.Tag, error)

	CreateTaggedPost(newTaggedPost *domain.TaggedPost) error
	GetTagsFromPostID(postID int64) ([]domain.Tag, error)
	DeleteTagFromPost(postID int64, tagID int64) error

	CreatePostView(newView *domain.PostView) error
	GetPostViewValue(postID int64, userID int64) (bool, error)
	GetViewsFromPostID(postID int64) ([]domain.PostView, error)
	CountViewsFromPostID(postID int64) (int64, error)
	DeletePostView(postID int64, userID int64) error

	CreatePostVote(newVote *domain.PostVote) error
	GetPostVoteValue(postID int64, userID int64) (*null.Bool, error)
	GetVotesFromPostID(postID int64) ([]domain.PostVote, error)
	CountVotesFromPostID(postID int64) (int64, int64, error)
	UpdatePostVote(up bool, postID int64, userID int64) error
	DeletePostVote(postID int64, userID int64) error

	CreateCommentVote(newVote *domain.CommentVote) error
	GetCommentVoteValue(commentID int64, userID int64) (*null.Bool, error)
	GetVotesFromCommentID(commentID int64) ([]domain.CommentVote, error)
	CountVotesFromCommentID(commentID int64) (int64, int64, error)
	UpdateCommentVote(up bool, commentID int64, userID int64) error
	DeleteCommentVote(commentID int64, userID int64) error

	CreateRelation(newRelation *domain.Relation) error
	GetFollowersFromUserID(userID int64) ([]domain.Relation, error)
	CountFollowersFromUserID(userID int64) (int64, error)
	GetFollowingsFromUserID(userID int64) ([]domain.Relation, error)
	CountFollowingsFromUserID(userID int64) (int64, error)
	DeleteRelation(followerID int64, followingID int64) error

	CreateSubscription(newSubscription *domain.Subscription) error
	GetSubscribersFromTopicID(topicID int64) ([]domain.Subscription, error)
	CountSubscribersFromTopicID(topicID int64) (int64, error)
	GetSubscribedTopicsFromUserID(userID int64) ([]domain.Subscription, error)
	CountSubscribedTopicsFromUserID(userID int64) (int64, error)
	DeleteSubscription(topicID int64, userID int64) error

	CreateBookmark(newBookmark *domain.Bookmark) error
	GetBookmarksFromUserID(userID int64) ([]domain.Bookmark, error)
	CountBookmarksFromUserID(userID int64) (int64, error)
	DeleteBookmark(postID int64, userID int64) error

	CreateBanHistory(newBanHistory *domain.BanHistory) error
	GetBanHistoryFromUserID(userID int64) ([]domain.BanHistory, error)
	GetCurrentBanFromUserID(userID int64) (*domain.BanHistory, error)
	DeleteBanHistory(startTime time.Time, userID int64) error
}

type Service

type Service interface {
	Login(usernameOrEmail string, password string) (int64, string, *SvcError)
	Signup(email string, username string, password string) (int64, string, *SvcError)

	GetUserByID(id int64) (*domain.User, *SvcError)
	GetUserIDByUsername(username string) (int64, *SvcError)
	UpdateUserByID(id int64, updatedUser *domain.User) *SvcError
	BanUserByID(id int64, moderatorID int64, reason string, startTime time.Time, endTime time.Time) *SvcError
	SearchUsers(options *domain.SearchUsersOptions) ([]domain.User, *SvcError)
	FollowUserByID(followerID int64, followingID int64) *SvcError
	UnfollowUserByID(followerID int64, followingID int64) *SvcError
	GetUserFollowers(id int64) ([]domain.User, *SvcError)
	GetUserFollowerCount(id int64) (int64, *SvcError)
	GetUserFollowings(id int64) ([]domain.User, *SvcError)
	GetUserFollowingCount(id int64) (int64, *SvcError)
	GetUserPostCount(id int64) (int64, *SvcError)
	GetUserRating(id int64) (int64, *SvcError)
	GetUserSubscriptions(id int64) ([]domain.Subscription, *SvcError)
	GetUserBookmarks(id int64) ([]domain.Bookmark, *SvcError)

	CreateTopic(topic string, hub string) (int64, *SvcError)
	GetTopicByID(id int64) (*domain.Topic, *SvcError)
	UpdateTopicByID(id int64, description string) *SvcError
	SearchTopics(options *domain.SearchTopicsOptions) ([]domain.Topic, *SvcError)

	CreatePost(title string, content string, authorID int64, topic string, hub string, tags []string) (int64, *SvcError)
	GetPostByID(id int64) (*domain.Post, *SvcError)
	GetPostInteractionsByUserID(id int64, userID int64) (bool, *null.Bool, *SvcError)
	UpdatePostByID(id int64, updatedPost *domain.Post) *SvcError
	MarkPostAsDeletedByID(id int64, reasonForDeletion string, moderatorID int64) *SvcError
	ViewPost(id int64, userID int64) *SvcError
	VotePost(id int64, userID int64, up null.Bool) *SvcError
	SearchPosts(options *domain.SearchPostsOptions) ([]domain.Post, *SvcError)
	GetPostsByAuthorID(authorID int64) *SvcError
	BookmarkPostWithID(postID int64, userID int64) *SvcError

	CreateComment(content string, authorID int64, postID null.Int, parentCommentID null.Int) (int64, *SvcError)
	GetCommentByID(commentID int64) (*domain.Comment, *SvcError)
	UpdateCommentByID(commentID int64, content string) *SvcError
	MarkCommentAsDeletedByID(commentID int64, postID int64, reasonForDeletion string, moderatorID int64) *SvcError
	VoteComment(id int64, userID int64, up null.Bool) *SvcError
	SearchComments(options *domain.SearchCommentsOptions) ([]domain.Comment, *SvcError)

	CreateTag(tag string, hub string) (int64, *SvcError)
	GetTagByID(id int64) (*domain.Tag, *SvcError)
	SearchTags(options *domain.SearchTagsOptions) ([]domain.Tag, *SvcError)
}

type SvcError

type SvcError struct {
	Code    int
	Message string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL