service

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 64 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

ProviderSetService is providers.

Functions

This section is empty.

Types

type AnswerService

type AnswerService struct {
	AnswerCommon *answercommon.AnswerCommon
	// contains filtered or unexported fields
}

AnswerService user service

func NewAnswerService

func NewAnswerService(
	answerRepo answercommon.AnswerRepo,
	questionRepo questioncommon.QuestionRepo,
	questionCommon *questioncommon.QuestionCommon,
	userCommon *usercommon.UserCommon,
	collectionCommon *collectioncommon.CollectionCommon,
	userRepo usercommon.UserRepo,
	revisionService *revision_common.RevisionService,
	answerAcceptActivityRepo *activity.AnswerActivityService,
	answerCommon *answercommon.AnswerCommon,
	voteRepo activity_common.VoteRepo,
) *AnswerService

func (*AnswerService) AdminSetAnswerStatus

func (as *AnswerService) AdminSetAnswerStatus(ctx context.Context, answerID string, setStatusStr string) error

func (*AnswerService) Get

func (as *AnswerService) Get(ctx context.Context, answerID, loginUserID string) (*schema.AnswerInfo, *schema.QuestionInfo, bool, error)

func (*AnswerService) Insert

func (as *AnswerService) Insert(ctx context.Context, req *schema.AnswerAddReq) (string, error)

func (*AnswerService) RemoveAnswer

func (as *AnswerService) RemoveAnswer(ctx context.Context, req *schema.RemoveAnswerReq) (err error)

RemoveAnswer delete answer

func (*AnswerService) SearchFormatInfo

func (as *AnswerService) SearchFormatInfo(ctx context.Context, dblist []*entity.Answer, loginUserID string, isAdmin bool) ([]*schema.AnswerInfo, error)

func (*AnswerService) SearchList

func (as *AnswerService) SearchList(ctx context.Context, search *schema.AnswerList) ([]*schema.AnswerInfo, int64, error)

func (*AnswerService) ShowFormat

func (as *AnswerService) ShowFormat(ctx context.Context, data *entity.Answer) *schema.AnswerInfo

func (*AnswerService) Update

func (as *AnswerService) Update(ctx context.Context, req *schema.AnswerUpdateReq) (string, error)

func (*AnswerService) UpdateAdopted

func (as *AnswerService) UpdateAdopted(ctx context.Context, req *schema.AnswerAdoptedReq) error

UpdateAdopted

type CollectionGroupRepo

type CollectionGroupRepo interface {
	AddCollectionGroup(ctx context.Context, collectionGroup *entity.CollectionGroup) (err error)
	AddCollectionDefaultGroup(ctx context.Context, userID string) (collectionGroup *entity.CollectionGroup, err error)
	UpdateCollectionGroup(ctx context.Context, collectionGroup *entity.CollectionGroup, cols []string) (err error)
	GetCollectionGroup(ctx context.Context, id string) (collectionGroup *entity.CollectionGroup, exist bool, err error)
	GetCollectionGroupPage(ctx context.Context, page, pageSize int, collectionGroup *entity.CollectionGroup) (collectionGroupList []*entity.CollectionGroup, total int64, err error)
	GetDefaultID(ctx context.Context, userID string) (collectionGroup *entity.CollectionGroup, has bool, err error)
}

CollectionGroupRepo collectionGroup repository

type CollectionGroupService

type CollectionGroupService struct {
	// contains filtered or unexported fields
}

CollectionGroupService user service

func NewCollectionGroupService

func NewCollectionGroupService(collectionGroupRepo CollectionGroupRepo) *CollectionGroupService

func (*CollectionGroupService) AddCollectionGroup

func (cs *CollectionGroupService) AddCollectionGroup(ctx context.Context, req *schema.AddCollectionGroupReq) (err error)

AddCollectionGroup add collection group

func (*CollectionGroupService) GetCollectionGroup

func (cs *CollectionGroupService) GetCollectionGroup(ctx context.Context, id string) (resp *schema.GetCollectionGroupResp, err error)

GetCollectionGroup get collection group one

func (*CollectionGroupService) UpdateCollectionGroup

func (cs *CollectionGroupService) UpdateCollectionGroup(ctx context.Context, req *schema.UpdateCollectionGroupReq, cols []string) (err error)

UpdateCollectionGroup update collection group

type CollectionService

type CollectionService struct {
	// contains filtered or unexported fields
}

CollectionService user service

func NewCollectionService

func NewCollectionService(
	collectionRepo collectioncommon.CollectionRepo,
	collectionGroupRepo CollectionGroupRepo,
	questionCommon *questioncommon.QuestionCommon,
) *CollectionService

func (*CollectionService) CollectionSwitch

func (cs *CollectionService) CollectionSwitch(ctx context.Context, dto *schema.CollectionSwitchDTO) (resp *schema.CollectionSwitchResp, err error)

type QuestionService

type QuestionService struct {
	// contains filtered or unexported fields
}

QuestionService user service

func NewQuestionService

func NewQuestionService(
	questionRepo questioncommon.QuestionRepo,
	tagCommon *tagcommon.TagCommonService,
	questioncommon *questioncommon.QuestionCommon,
	userCommon *usercommon.UserCommon,
	revisionService *revision_common.RevisionService,
	metaService *meta.MetaService,
	collectionCommon *collectioncommon.CollectionCommon,
	answerActivityService *activity.AnswerActivityService,
) *QuestionService

func (*QuestionService) AddQuestion

func (qs *QuestionService) AddQuestion(ctx context.Context, req *schema.QuestionAdd) (questionInfo *schema.QuestionInfo, err error)

AddQuestion add question

func (*QuestionService) AdminSetQuestionStatus

func (qs *QuestionService) AdminSetQuestionStatus(ctx context.Context, questionID string, setStatusStr string) error

func (*QuestionService) ChangeTag

func (qs *QuestionService) ChangeTag(ctx context.Context, objectTagData *schema.TagChange) error

func (*QuestionService) CheckChangeTag added in v0.4.0

func (qs *QuestionService) CheckChangeTag(ctx context.Context, oldobjectTagData, objectTagData []*entity.Tag) (bool, []string)

func (*QuestionService) CloseMsgList

func (qs *QuestionService) CloseMsgList(ctx context.Context, lang i18n.Language) (
	resp []*schema.GetCloseTypeResp, err error,
)

CloseMsgList list close question condition

func (*QuestionService) CloseQuestion

func (qs *QuestionService) CloseQuestion(ctx context.Context, req *schema.CloseQuestionReq) error

func (*QuestionService) CmsSearchAnswerList

func (qs *QuestionService) CmsSearchAnswerList(ctx context.Context, search *entity.CmsAnswerSearch, loginUserID string) ([]*schema.AdminAnswerInfo, int64, error)

CmsSearchList

func (*QuestionService) CmsSearchList

func (qs *QuestionService) CmsSearchList(ctx context.Context, search *schema.CmsQuestionSearch, loginUserID string) ([]*schema.AdminQuestionInfo, int64, error)

func (*QuestionService) GetQuestion

func (qs *QuestionService) GetQuestion(ctx context.Context, id, loginUserID string, addpv bool, isAdmin bool) (resp *schema.QuestionInfo, err error)

GetQuestion get question one

func (*QuestionService) RemoveQuestion

func (qs *QuestionService) RemoveQuestion(ctx context.Context, req *schema.RemoveQuestionReq) (err error)

RemoveQuestion delete question

func (*QuestionService) SearchByTitleLike

func (qs *QuestionService) SearchByTitleLike(ctx context.Context, title string, loginUserID string) ([]*schema.QuestionBaseInfo, error)

SearchByTitleLike

func (*QuestionService) SearchList

func (qs *QuestionService) SearchList(ctx context.Context, req *schema.QuestionSearch, loginUserID string) ([]*schema.QuestionInfo, int64, error)

SearchList

func (*QuestionService) SearchUserAnswerList

func (qs *QuestionService) SearchUserAnswerList(ctx context.Context, userName, order string, page, pageSize int, loginUserID string) ([]*schema.UserAnswerInfo, int64, error)

func (*QuestionService) SearchUserCollectionList

func (qs *QuestionService) SearchUserCollectionList(ctx context.Context, page, pageSize int, loginUserID string) ([]*schema.QuestionInfo, int64, error)

func (*QuestionService) SearchUserList

func (qs *QuestionService) SearchUserList(ctx context.Context, userName, order string, page, pageSize int, loginUserID string) ([]*schema.UserQuestionInfo, int64, error)

func (*QuestionService) SearchUserTopList

func (qs *QuestionService) SearchUserTopList(ctx context.Context, userName string, loginUserID string) ([]*schema.UserQuestionInfo, []*schema.UserAnswerInfo, error)

func (*QuestionService) SimilarQuestion

func (qs *QuestionService) SimilarQuestion(ctx context.Context, questionID string, loginUserID string) ([]*schema.QuestionInfo, int64, error)

SimilarQuestion

func (*QuestionService) UpdateQuestion

func (qs *QuestionService) UpdateQuestion(ctx context.Context, req *schema.QuestionUpdate) (questionInfo *schema.QuestionInfo, err error)

UpdateQuestion update question

type RevisionService

type RevisionService struct {
	// contains filtered or unexported fields
}

RevisionService user service

func NewRevisionService

func NewRevisionService(
	revisionRepo revision.RevisionRepo,
	userCommon *usercommon.UserCommon,
	questionCommon *questioncommon.QuestionCommon,
	answerService *AnswerService) *RevisionService

func (*RevisionService) GetRevisionList

func (rs *RevisionService) GetRevisionList(ctx context.Context, req *schema.GetRevisionListReq) (resp []schema.GetRevisionResp, err error)

GetRevisionList get revision list all

type SearchService

type SearchService struct {
	// contains filtered or unexported fields
}

func NewSearchService

func NewSearchService(
	searchParser *search_parser.SearchParser,
	searchRepo search_common.SearchRepo,
) *SearchService

func (*SearchService) Search

func (ss *SearchService) Search(ctx context.Context, dto *schema.SearchDTO) (resp []schema.SearchResp, total int64, extra interface{}, err error)

Search search contents

type UserService

type UserService struct {
	// contains filtered or unexported fields
}

UserService user service

func NewUserService

func NewUserService(userRepo usercommon.UserRepo,
	userActivity activity.UserActiveActivityRepo,
	emailService *export.EmailService,
	authService *auth.AuthService,
	serviceConfig *service_config.ServiceConfig,
	siteInfoService *siteinfo_common.SiteInfoCommonService,
) *UserService

func (*UserService) EmailLogin

func (us *UserService) EmailLogin(ctx context.Context, req *schema.UserEmailLogin) (resp *schema.GetUserResp, err error)

EmailLogin email login

func (*UserService) GetOtherUserInfoByUsername

func (us *UserService) GetOtherUserInfoByUsername(ctx context.Context, username string) (
	resp *schema.GetOtherUserInfoResp, err error,
)

func (*UserService) GetUserInfoByUserID

func (us *UserService) GetUserInfoByUserID(ctx context.Context, token, userID string) (resp *schema.GetUserToSetShowResp, err error)

GetUserInfoByUserID get user info by user id

func (*UserService) RetrievePassWord

func (us *UserService) RetrievePassWord(ctx context.Context, req *schema.UserRetrievePassWordRequest) (string, error)

RetrievePassWord .

func (*UserService) UpdateInfo

func (us *UserService) UpdateInfo(ctx context.Context, req *schema.UpdateInfoRequest) (err error)

UpdateInfo update user info

func (*UserService) UseRePassword

func (us *UserService) UseRePassword(ctx context.Context, req *schema.UserRePassWordRequest) (resp *schema.GetUserResp, err error)

UseRePassword

func (*UserService) UserChangeEmailSendCode

func (us *UserService) UserChangeEmailSendCode(ctx context.Context, req *schema.UserChangeEmailSendCodeReq) (
	resp *validator.FormErrorField, err error)

UserChangeEmailSendCode user change email verification

func (*UserService) UserChangeEmailVerify

func (us *UserService) UserChangeEmailVerify(ctx context.Context, content string) (err error)

UserChangeEmailVerify user change email verify code

func (*UserService) UserEmailHas

func (us *UserService) UserEmailHas(ctx context.Context, email string) (bool, error)

func (*UserService) UserModifyPassWordVerification

func (us *UserService) UserModifyPassWordVerification(ctx context.Context, request *schema.UserModifyPassWordRequest) (bool, error)

func (*UserService) UserModifyPassword

func (us *UserService) UserModifyPassword(ctx context.Context, request *schema.UserModifyPassWordRequest) error

UserModifyPassword user modify password

func (*UserService) UserNoticeSet

func (us *UserService) UserNoticeSet(ctx context.Context, userID string, noticeSwitch bool) (
	resp *schema.UserNoticeSetResp, err error,
)

func (*UserService) UserRegisterByEmail

func (us *UserService) UserRegisterByEmail(ctx context.Context, registerUserInfo *schema.UserRegisterReq) (
	resp *schema.GetUserResp, err error,
)

UserRegisterByEmail user register

func (*UserService) UserUpdateInterface added in v0.3.0

func (us *UserService) UserUpdateInterface(ctx context.Context, req *schema.UpdateUserInterfaceRequest) (err error)

UserUpdateInterface update user interface

func (*UserService) UserVerifyEmail

func (us *UserService) UserVerifyEmail(ctx context.Context, req *schema.UserVerifyEmailReq) (resp *schema.GetUserResp, err error)

func (*UserService) UserVerifyEmailSend

func (us *UserService) UserVerifyEmailSend(ctx context.Context, userID string) error

type VoteRepo

type VoteRepo interface {
	VoteUp(ctx context.Context, objectID string, userID, objectUserID string) (resp *schema.VoteResp, err error)
	VoteDown(ctx context.Context, objectID string, userID, objectUserID string) (resp *schema.VoteResp, err error)
	VoteUpCancel(ctx context.Context, objectID string, userID, objectUserID string) (resp *schema.VoteResp, err error)
	VoteDownCancel(ctx context.Context, objectID string, userID, objectUserID string) (resp *schema.VoteResp, err error)
	GetVoteResultByObjectId(ctx context.Context, objectID string) (resp *schema.VoteResp, err error)
	ListUserVotes(ctx context.Context, userID string, req schema.GetVoteWithPageReq, activityTypes []int) (voteList []entity.Activity, total int64, err error)
}

VoteRepo activity repository

type VoteService

type VoteService struct {
	UniqueIDRepo unique.UniqueIDRepo
	// contains filtered or unexported fields
}

VoteService user service

func NewVoteService

func NewVoteService(
	VoteRepo VoteRepo,
	uniqueIDRepo unique.UniqueIDRepo,
	configRepo config.ConfigRepo,
	questionRepo questioncommon.QuestionRepo,
	answerRepo answercommon.AnswerRepo,
	commentCommonRepo comment_common.CommentCommonRepo,
	objectService *object_info.ObjService,
) *VoteService

func (*VoteService) GetObjectUserID

func (vs *VoteService) GetObjectUserID(ctx context.Context, objectID string) (userID string, err error)

func (*VoteService) ListUserVotes

func (vs *VoteService) ListUserVotes(ctx context.Context, req schema.GetVoteWithPageReq) (model *pager.PageModel, err error)

ListUserVotes list user's votes

func (*VoteService) VoteDown

func (as *VoteService) VoteDown(ctx context.Context, dto *schema.VoteDTO) (voteResp *schema.VoteResp, err error)

VoteDown vote down

func (*VoteService) VoteUp

func (as *VoteService) VoteUp(ctx context.Context, dto *schema.VoteDTO) (voteResp *schema.VoteResp, err error)

VoteUp vote up

Jump to

Keyboard shortcuts

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