content

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 56 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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,
	externalNotificationQueueService notice_queue.ExternalNotificationQueueService,
	activityQueueService activity_queue.ActivityQueueService,
	reviewService *review.ReviewService,
	eventQueueService event_queue.EventQueueService,
) *AnswerService

func (*AnswerService) AcceptAnswer

func (as *AnswerService) AcceptAnswer(ctx context.Context, req *schema.AcceptAnswerReq) (err error)

AcceptAnswer accept answer

func (*AnswerService) AdminSetAnswerStatus

func (as *AnswerService) AdminSetAnswerStatus(ctx context.Context, req *schema.AdminUpdateAnswerStatusReq) error

func (*AnswerService) Get

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

func (*AnswerService) GetCountByUserIDQuestionID

func (as *AnswerService) GetCountByUserIDQuestionID(ctx context.Context, userId string, questionId string) (ids []string, err error)

func (*AnswerService) GetDetail added in v1.3.1

func (as *AnswerService) GetDetail(ctx context.Context, answerID string) (*schema.AnswerInfo, error)

func (*AnswerService) Insert

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

func (*AnswerService) RecoverAnswer

func (as *AnswerService) RecoverAnswer(ctx context.Context, req *schema.RecoverAnswerReq) (err error)

RecoverAnswer recover deleted answer

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)

type QuestionService

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

QuestionService user service

func NewQuestionService

func NewQuestionService(
	activityRepo activity_common.ActivityRepo,
	questionRepo questioncommon.QuestionRepo,
	answerRepo answercommon.AnswerRepo,
	tagCommon *tagcommon.TagCommonService,
	tagService *tag.TagService,
	questioncommon *questioncommon.QuestionCommon,
	userCommon *usercommon.UserCommon,
	userRepo usercommon.UserRepo,
	userRoleRelService *role.UserRoleRelService,
	revisionService *revision_common.RevisionService,
	metaService *metacommon.MetaCommonService,
	collectionCommon *collectioncommon.CollectionCommon,
	answerActivityService *activity.AnswerActivityService,
	emailService *export.EmailService,
	notificationQueueService notice_queue.NotificationQueueService,
	externalNotificationQueueService notice_queue.ExternalNotificationQueueService,
	activityQueueService activity_queue.ActivityQueueService,
	siteInfoService siteinfo_common.SiteInfoCommonService,
	newQuestionNotificationService *notification.ExternalNotificationService,
	reviewService *review.ReviewService,
	configService *config.ConfigService,
	eventQueueService event_queue.EventQueueService,
) *QuestionService

func (*QuestionService) AddQuestion

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

AddQuestion add question

func (*QuestionService) AddQuestionCheckTags

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

func (*QuestionService) AdminAnswerPage

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

AdminAnswerPage search answer list

func (*QuestionService) AdminQuestionPage

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, req *schema.AdminUpdateQuestionStatusReq) error

func (*QuestionService) ChangeTag

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

func (*QuestionService) CheckAddQuestion

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

func (*QuestionService) CheckChangeReservedTag

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

GetQuestion get question one

func (*QuestionService) GetQuestionAndAddPV

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

GetQuestionAndAddPV get question one

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

func (*QuestionService) GetQuestionPage

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

GetQuestionPage query questions page

func (*QuestionService) GetQuestionsByTitle

func (qs *QuestionService) GetQuestionsByTitle(ctx context.Context, title string) (
	resp []*schema.QuestionBaseInfo, err error)

GetQuestionsByTitle get questions by title

func (*QuestionService) GetRecommendQuestionPage added in v1.4.0

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

GetRecommendQuestionPage retrieves recommended question page based on following tags and questions.

func (*QuestionService) HasNewTag

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

HasNewTag

func (*QuestionService) InviteUserInfo

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

func (*QuestionService) OperationQuestion

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

OperationQuestion

func (*QuestionService) PersonalAnswerPage

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

func (*QuestionService) PersonalCollectionPage

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

PersonalCollectionPage get collection list by user

func (*QuestionService) PersonalQuestionPage

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

PersonalQuestionPage get question list by user

func (*QuestionService) RecoverQuestion

func (qs *QuestionService) RecoverQuestion(ctx context.Context, req *schema.QuestionRecoverReq) (err error)

func (*QuestionService) RefreshHottestCron added in v1.3.6

func (q *QuestionService) RefreshHottestCron(ctx context.Context)

func (*QuestionService) RemoveQuestion

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

RemoveQuestion delete question

func (*QuestionService) ReopenQuestion

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

ReopenQuestion reopen question

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

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

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

func (*QuestionService) UpdateQuestionInviteUser

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,
	reportRepo report_common.ReportRepo,
	reviewService *review.ReviewService,
	reviewActivity activity.ReviewActivityRepo,
) *RevisionService

func (*RevisionService) CheckCanUpdateRevision

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

CheckCanUpdateRevision can check revision

func (*RevisionService) GetReviewingType

func (rs *RevisionService) GetReviewingType(ctx context.Context, req *schema.GetReviewingTypeReq) (resp []*schema.GetReviewingTypeResp, err error)

GetReviewingType get reviewing type

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

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

GetUnreviewedRevisionPage get unreviewed list

func (*RevisionService) RevisionAudit

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, 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,
	userNotificationConfigRepo user_notification_config.UserNotificationConfigRepo,
	userNotificationConfigService *user_notification_config.UserNotificationConfigService,
	questionService *questioncommon.QuestionCommon,
	eventQueueService event_queue.EventQueueService,
) *UserService

func (*UserService) EmailLogin

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

EmailLogin email login

func (*UserService) GetOtherUserInfoByUsername

func (us *UserService) GetOtherUserInfoByUsername(ctx context.Context, req *schema.GetOtherUserInfoByUsernameReq) (
	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) GetUserStaff added in v1.3.1

func (us *UserService) GetUserStaff(ctx context.Context, req *schema.GetUserStaffReq) (
	resp []*schema.GetUserStaffResp, err error)

GetUserStaff get user staff

func (*UserService) RetrievePassWord

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

RetrievePassWord .

func (*UserService) SearchUserListByName

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

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) 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) UserRanking

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) UserUnsubscribeNotification

func (us *UserService) UserUnsubscribeNotification(
	ctx context.Context, req *schema.UserUnsubscribeNotificationReq) (err error)

UserUnsubscribeNotification user unsubscribe email notification

func (*UserService) UserUpdateInterface

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,
	eventQueueService event_queue.EventQueueService,
) *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