service

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: Apache-2.0 Imports: 68 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,
	emailService *export.EmailService,
	roleService *role.UserRoleRelService,
	notificationQueueService notice_queue.NotificationQueueService,
	activityQueueService activity_queue.ActivityQueueService,
) *AnswerService

func (*AnswerService) AdminSetAnswerStatus

func (as *AnswerService) AdminSetAnswerStatus(ctx context.Context, req *schema.AdminSetAnswerStatusRequest) 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, answers []*entity.Answer, req *schema.AnswerListReq) (
	[]*schema.AnswerInfo, error)

func (*AnswerService) SearchList

func (as *AnswerService) SearchList(ctx context.Context, req *schema.AnswerListReq) ([]*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) UpdateAccepted added in v1.0.1

func (as *AnswerService) UpdateAccepted(ctx context.Context, req *schema.AnswerAcceptedReq) error

UpdateAccepted

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,
	userRepo usercommon.UserRepo,
	revisionService *revision_common.RevisionService,
	metaService *meta.MetaService,
	collectionCommon *collectioncommon.CollectionCommon,
	answerActivityService *activity.AnswerActivityService,
	emailService *export.EmailService,
	notificationQueueService notice_queue.NotificationQueueService,
	activityQueueService activity_queue.ActivityQueueService,
	siteInfoService siteinfo_common.SiteInfoCommonService,
) *QuestionService

func (*QuestionService) AddQuestion

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

AddQuestion add question

func (*QuestionService) AddQuestionCheckTags added in v1.0.0

func (qs *QuestionService) AddQuestionCheckTags(ctx context.Context, Tags []*entity.Tag) ([]string, error)

func (*QuestionService) AdminAnswerPage added in v1.1.1

func (qs *QuestionService) AdminAnswerPage(ctx context.Context, req *schema.AdminAnswerPageReq) (
	resp *pager.PageModel, err error)

AdminAnswerPage search answer list

func (*QuestionService) AdminQuestionPage added in v1.1.1

func (qs *QuestionService) AdminQuestionPage(
	ctx context.Context, req *schema.AdminQuestionPageReq) (
	resp *pager.PageModel, err error)

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) CheckAddQuestion added in v1.0.1

func (qs *QuestionService) CheckAddQuestion(ctx context.Context, req *schema.QuestionAdd) (errorlist any, err error)

func (*QuestionService) CheckChangeReservedTag added in v0.5.0

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

func (*QuestionService) CloseQuestion

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

func (*QuestionService) GetQuestion

func (qs *QuestionService) GetQuestion(ctx context.Context, questionID, userID string,
	per schema.QuestionPermission) (resp *schema.QuestionInfo, err error)

GetQuestion get question one

func (*QuestionService) GetQuestionAndAddPV added in v0.5.0

func (qs *QuestionService) GetQuestionAndAddPV(ctx context.Context, questionID, loginUserID string,
	per schema.QuestionPermission) (
	resp *schema.QuestionInfo, err error)

GetQuestionAndAddPV get question one

func (*QuestionService) GetQuestionPage added in v1.0.2

func (qs *QuestionService) GetQuestionPage(ctx context.Context, req *schema.QuestionPageReq) (
	questions []*schema.QuestionPageResp, total int64, err error)

GetQuestionPage query questions page

func (*QuestionService) HasNewTag added in v1.1.0

func (qs *QuestionService) HasNewTag(ctx context.Context, tags []*schema.TagItem) (bool, error)

HasNewTag

func (*QuestionService) InviteUserInfo added in v1.1.0

func (qs *QuestionService) InviteUserInfo(ctx context.Context, questionID string) (inviteList []*schema.UserBasicInfo, err error)

func (*QuestionService) OperationQuestion added in v1.0.9

func (qs *QuestionService) OperationQuestion(ctx context.Context, req *schema.OperationQuestionReq) (err error)

OperationQuestion

func (*QuestionService) PersonalAnswerPage added in v1.1.0

func (qs *QuestionService) PersonalAnswerPage(ctx context.Context, req *schema.PersonalAnswerPageReq) (
	pageModel *pager.PageModel, err error)

func (*QuestionService) PersonalCollectionPage added in v1.1.0

func (qs *QuestionService) PersonalCollectionPage(ctx context.Context, req *schema.PersonalCollectionPageReq) (
	pageModel *pager.PageModel, err error)

PersonalCollectionPage get collection list by user

func (*QuestionService) PersonalQuestionPage added in v1.1.0

func (qs *QuestionService) PersonalQuestionPage(ctx context.Context, req *schema.PersonalQuestionPageReq) (
	pageModel *pager.PageModel, err error)

PersonalQuestionPage get question list by user

func (*QuestionService) RemoveQuestion

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

RemoveQuestion delete question

func (*QuestionService) ReopenQuestion added in v1.0.0

func (qs *QuestionService) ReopenQuestion(ctx context.Context, req *schema.ReopenQuestionReq) error

ReopenQuestion reopen question

func (*QuestionService) SearchByTitleLike

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

SearchByTitleLike

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.QuestionPageResp, int64, error)

SimilarQuestion

func (*QuestionService) SitemapCron added in v1.0.0

func (qs *QuestionService) SitemapCron(ctx context.Context)

func (*QuestionService) UpdateQuestion

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

UpdateQuestion update question

func (*QuestionService) UpdateQuestionCheckTags added in v1.0.0

func (qs *QuestionService) UpdateQuestionCheckTags(ctx context.Context, req *schema.QuestionUpdate) (errorlist []*validator.FormErrorField, err error)

func (*QuestionService) UpdateQuestionInviteUser added in v1.1.0

func (qs *QuestionService) UpdateQuestionInviteUser(ctx context.Context, req *schema.QuestionUpdateInviteUser) (err error)

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,
	objectInfoService *object_info.ObjService,
	questionRepo questioncommon.QuestionRepo,
	answerRepo answercommon.AnswerRepo,
	tagRepo tag_common.TagRepo,
	tagCommon *tagcommon.TagCommonService,
	notificationQueueService notice_queue.NotificationQueueService,
	activityQueueService activity_queue.ActivityQueueService,
) *RevisionService

func (*RevisionService) CheckCanUpdateRevision added in v0.5.0

func (rs *RevisionService) CheckCanUpdateRevision(ctx context.Context, req *schema.CheckCanQuestionUpdate) (
	resp *schema.ErrTypeData, err error)

CheckCanUpdateRevision can check revision

func (*RevisionService) GetRevisionList

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

GetRevisionList get revision list all

func (*RevisionService) GetUnreviewedRevisionPage added in v0.5.0

func (rs *RevisionService) GetUnreviewedRevisionPage(ctx context.Context, req *schema.RevisionSearch) (
	resp *pager.PageModel, err error)

GetUnreviewedRevisionPage get unreviewed list

func (*RevisionService) RevisionAudit added in v0.5.0

func (rs *RevisionService) RevisionAudit(ctx context.Context, req *schema.RevisionAuditReq) (err error)

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, 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,
	activityRepo activity_common.ActivityRepo,
	emailService *export.EmailService,
	authService *auth.AuthService,
	siteInfoService siteinfo_common.SiteInfoCommonService,
	userRoleService *role.UserRoleRelService,
	userCommonService *usercommon.UserCommon,
	userExternalLoginService *user_external_login.UserExternalLoginService,
) *UserService

func (*UserService) EmailLogin

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

EmailLogin email login

func (*UserService) GetOtherUserInfoByUsername

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

func (*UserService) GetUserInfoByUserID

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

GetUserInfoByUserID get user info by user id

func (*UserService) RetrievePassWord

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

RetrievePassWord .

func (*UserService) SearchUserListByName added in v1.1.0

func (us *UserService) SearchUserListByName(ctx context.Context, req *schema.GetOtherUserInfoByUsernameReq) (
	resp []*schema.UserBasicInfo, err error)

func (*UserService) UpdateInfo

func (us *UserService) UpdateInfo(ctx context.Context, req *schema.UpdateInfoRequest) (
	errFields []*validator.FormErrorField, err error)

UpdateInfo update user info

func (*UserService) UpdatePasswordWhenForgot added in v1.1.0

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

UpdatePasswordWhenForgot update user password when user forgot password

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) (resp *schema.UserLoginResp, 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, req *schema.UserModifyPasswordReq) (bool, error)

func (*UserService) UserModifyPassword

func (us *UserService) UserModifyPassword(ctx context.Context, req *schema.UserModifyPasswordReq) 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) UserRanking added in v1.0.0

func (us *UserService) UserRanking(ctx context.Context) (resp *schema.UserRankingResp, err error)

UserRanking get user ranking

func (*UserService) UserRegisterByEmail

func (us *UserService) UserRegisterByEmail(ctx context.Context, registerUserInfo *schema.UserRegisterReq) (
	resp *schema.UserLoginResp, errFields []*validator.FormErrorField, err error,
)

UserRegisterByEmail user register

func (*UserService) UserUnsubscribeEmailNotification added in v1.0.2

func (us *UserService) UserUnsubscribeEmailNotification(
	ctx context.Context, req *schema.UserUnsubscribeEmailNotificationReq) (err error)

UserUnsubscribeEmailNotification user unsubscribe email notification

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.UserLoginResp, err error)

func (*UserService) UserVerifyEmailSend

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

type VoteRepo

type VoteRepo interface {
	Vote(ctx context.Context, op *schema.VoteOperationInfo) (err error)
	CancelVote(ctx context.Context, op *schema.VoteOperationInfo) (err error)
	GetAndSaveVoteResult(ctx context.Context, objectID, objectType string) (up, down int64, err error)
	ListUserVotes(ctx context.Context, userID string, page int, pageSize int, activityTypes []int) (
		voteList []*entity.Activity, total int64, err error)
}

VoteRepo activity repository

type VoteService

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

VoteService user service

func NewVoteService

func NewVoteService(
	voteRepo VoteRepo,
	configService *config.ConfigService,
	questionRepo questioncommon.QuestionRepo,
	answerRepo answercommon.AnswerRepo,
	commentCommonRepo comment_common.CommentCommonRepo,
	objectService *object_info.ObjService,
) *VoteService

func (*VoteService) ListUserVotes

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

ListUserVotes list user's votes

func (*VoteService) VoteDown

func (vs *VoteService) VoteDown(ctx context.Context, req *schema.VoteReq) (resp *schema.VoteResp, err error)

VoteDown vote down

func (*VoteService) VoteUp

func (vs *VoteService) VoteUp(ctx context.Context, req *schema.VoteReq) (resp *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