service

package
v0.0.0-...-702fcad Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostService

type PostService interface {
	SavePost(post *dto.Post) error
	FindOnePost(filter interface{}) (*dto.Post, error)
	FindPostList(filter interface{}, limit int64, skip int64, sort map[string]int) ([]dto.Post, error)
	FindPostsIncludeProfile(filter interface{}, limit int64, skip int64, sort map[string]int) ([]dto.Post, error)
	QueryPost(search string, ownerUserIds []uuid.UUID, postTypeId int, sortBy string, page int64) ([]dto.Post, error)
	QueryPostIncludeUser(search string, ownerUserIds []uuid.UUID, collectiveIds []uuid.UUID, postTypeId int, sortBy string, page int64) ([]dto.Post, error)
	FindById(objectId uuid.UUID) (*dto.Post, error)
	FindByOwnerUserId(ownerUserId uuid.UUID) ([]dto.Post, error)
	FindByURLKey(urlKey string) (*dto.Post, error)
	UpdatePost(filter interface{}, data interface{}, opts ...*repo.UpdateOptions) error
	UpdateManyPost(filter interface{}, data interface{}, opts ...*repo.UpdateOptions) error
	UpdatePostById(data *models.PostUpdateModel) error
	DeletePost(filter interface{}) error
	DeletePostByOwner(ownerUserId uuid.UUID, postId uuid.UUID) error
	DeleteManyPost(filter interface{}) error
	CreatePostIndex(indexes map[string]interface{}) error
	DisableCommnet(OwnerUserId uuid.UUID, objectId uuid.UUID, value bool) error
	DisableSharing(OwnerUserId uuid.UUID, objectId uuid.UUID, value bool) error
	IncrementScoreCount(objectId uuid.UUID, ownerUserId uuid.UUID, displayName string, avatar string) error
	DecrementScoreCount(objectId uuid.UUID, ownerUserId uuid.UUID, displayName string, avatar string) error
	Increment(objectId uuid.UUID, field string, value int) error
	IncrementCommentCount(objectId uuid.UUID) error
	DecrementCommentCount(objectId uuid.UUID) error
	UpdatePostProfile(ownerUserId uuid.UUID, ownerDisplayName string, ownerAvatar string) error
	UpdatePostURLKey(postId uuid.UUID, urlKey string) error
}

func NewPostService

func NewPostService(db interface{}) (PostService, error)

NewPostService initializes PostService's dependencies and create new PostService struct

type PostServiceImpl

type PostServiceImpl struct {
	PostRepo coreData.Repository
}

PostService handlers with injected dependencies

func (PostServiceImpl) CreatePostIndex

func (s PostServiceImpl) CreatePostIndex(indexes map[string]interface{}) error

CreatePostIndex create index for post search.

func (PostServiceImpl) Decrement

func (s PostServiceImpl) Decrement(objectId uuid.UUID, field string, value int) error

Decrement decrement a post field

func (PostServiceImpl) DecrementCommentCount

func (s PostServiceImpl) DecrementCommentCount(objectId uuid.UUID) error

DecrementCommentCount increment comment count of post by -1

func (PostServiceImpl) DecrementScoreCount

func (s PostServiceImpl) DecrementScoreCount(objectId uuid.UUID, ownerUserId uuid.UUID, displayName string, avatar string) error

DecrementScoreCount decrement score of post

func (PostServiceImpl) DeleteManyPost

func (s PostServiceImpl) DeleteManyPost(filter interface{}) error

DeleteManyPost delete many post by filter

func (PostServiceImpl) DeletePost

func (s PostServiceImpl) DeletePost(filter interface{}) error

DeletePost delete post by filter

func (PostServiceImpl) DeletePostByOwner

func (s PostServiceImpl) DeletePostByOwner(ownerUserId uuid.UUID, postId uuid.UUID) error

DeletePost delete post by ownerUserId and postId

func (PostServiceImpl) DisableCommnet

func (s PostServiceImpl) DisableCommnet(OwnerUserId uuid.UUID, objectId uuid.UUID, value bool) error

DisableCommnet

func (PostServiceImpl) DisableSharing

func (s PostServiceImpl) DisableSharing(OwnerUserId uuid.UUID, objectId uuid.UUID, value bool) error

DisableSharing

func (PostServiceImpl) FindById

func (s PostServiceImpl) FindById(objectId uuid.UUID) (*dto.Post, error)

FindById find by post id

func (PostServiceImpl) FindByOwnerUserId

func (s PostServiceImpl) FindByOwnerUserId(ownerUserId uuid.UUID) ([]dto.Post, error)

FindByOwnerUserId find by owner user id

func (PostServiceImpl) FindByURLKey

func (s PostServiceImpl) FindByURLKey(urlKey string) (*dto.Post, error)

FindByURLKey find by URL key

func (PostServiceImpl) FindOnePost

func (s PostServiceImpl) FindOnePost(filter interface{}) (*dto.Post, error)

FindOnePost get one post

func (PostServiceImpl) FindPostList

func (s PostServiceImpl) FindPostList(filter interface{}, limit int64, skip int64, sort map[string]int) ([]dto.Post, error)

FindPostList get all posts by filter

func (PostServiceImpl) FindPostsIncludeProfile

func (s PostServiceImpl) FindPostsIncludeProfile(filter interface{}, limit int64, skip int64, sort map[string]int) ([]dto.Post, error)

FindPostsIncludeProfile get all posts by filter including user profile entity

func (PostServiceImpl) Increment

func (s PostServiceImpl) Increment(objectId uuid.UUID, field string, value int) error

Increment increment a post field

func (PostServiceImpl) IncrementCommentCount

func (s PostServiceImpl) IncrementCommentCount(objectId uuid.UUID) error

IncrementCommentCount increment comment count of post by +1

func (PostServiceImpl) IncrementScoreCount

func (s PostServiceImpl) IncrementScoreCount(objectId uuid.UUID, ownerUserId uuid.UUID, displayName string, avatar string) error

IncrementScoreCount increment score of post

func (PostServiceImpl) QueryPost

func (s PostServiceImpl) QueryPost(search string, ownerUserIds []uuid.UUID, postTypeId int, sortBy string, page int64) ([]dto.Post, error)

QueryPost get all posts by query

func (PostServiceImpl) QueryPostIncludeUser

func (s PostServiceImpl) QueryPostIncludeUser(search string, ownerUserIds []uuid.UUID, collectiveIds []uuid.UUID, postTypeId int, sortBy string, page int64) ([]dto.Post, error)

QueryPostIncludeUser get all posts by query including user entity

func (PostServiceImpl) SavePost

func (s PostServiceImpl) SavePost(post *dto.Post) error

SavePost save the post

func (PostServiceImpl) UpdateManyPost

func (s PostServiceImpl) UpdateManyPost(filter interface{}, data interface{}, opts ...*coreData.UpdateOptions) error

UpdateManyPost update the post

func (PostServiceImpl) UpdatePost

func (s PostServiceImpl) UpdatePost(filter interface{}, data interface{}, opts ...*coreData.UpdateOptions) error

UpdatePost update the post

func (PostServiceImpl) UpdatePostById

func (s PostServiceImpl) UpdatePostById(data *models.PostUpdateModel) error

UpdatePost update the post

func (PostServiceImpl) UpdatePostProfile

func (s PostServiceImpl) UpdatePostProfile(ownerUserId uuid.UUID, ownerDisplayName string, ownerAvatar string) error

UpdatePostProfile update the post

func (PostServiceImpl) UpdatePostURLKey

func (s PostServiceImpl) UpdatePostURLKey(postId uuid.UUID, urlKey string) error

UpdatePostURLKey update the post URL key

Jump to

Keyboard shortcuts

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